1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
#!/bin/sh
set -C -e -u
DEV_PKG=`sed -nr '/^Package: (libadacgi.*-dev)$$/{s//\1/p;q}' debian/control`
cd "$AUTOPKGTEST_TMP"
cp -a /usr/share/doc/$DEV_PKG/examples/* .
gprbuild -v examples.gpr
REQUEST_METHOD=GET QUERY_STRING='' ./demo > tmp1
diff tmp1 - <<EOF
Content-type: text/html
<html><head><title>Demonstration of Ada 95 Binding to CGI</title>
</head><body>
<h1>AdaCGI Demonstration Form</h1>
<p>This form demonstrates an Ada 95 binding to CGI.<p>
<form method="POST">
What is your name: <input name="name" size="40">
<p>What topping would you like on your pizza?<p><ol>
<li><input type="checkbox" name="topping" value="pepperoni" checked>Pepperoni.
<li><input type="checkbox" name="topping" value="sausage">Sausage.
<li><input type="checkbox" name="topping" value="anchovies">Anchovies.
</ol>
Would you like us to call ahead?
<dl>
<dd> <input type="radio" name="callfirst" value="yes" checked> <i>Yes.</i>
<dd> <input type="radio" name="callfirst" value="no"> <i>No.</i>
</dl>
<p> <input type="submit"> <input type="reset">
</form>
</body></html>
EOF
REQUEST_METHOD=GET QUERY_STRING='name=David&topping=anchovies&callfirst=no' ./demo > tmp2
diff tmp2 - <<EOF
Content-type: text/html
<html><head><title>Form Result of Demo Ada 95 Binding to CGI</title>
</head><body>
<h1>Form Result of Demo</h1>
<p>Your name is <i>David</i>
<p>The keys and values sent were:<p>
<pre>
<b>name</b>: <i>David</i>
<b>topping</b>: <i>anchovies</i>
<b>callfirst</b>: <i>no</i>
</pre>
</body></html>
EOF
REQUEST_METHOD=GET QUERY_STRING='' ./minimal > tmp3
diff tmp3 - <<EOF
Content-type: text/html
<html><head><title>Minimal Form Demonstration</title>
</head><body>
<form method="POST">What's your Name?<input name="username"><input type="submit"></form>
</body></html>
EOF
REQUEST_METHOD=GET QUERY_STRING='x=a&y=b' ./minimal > tmp4
diff tmp4 - <<EOF
Content-type: text/html
<html><head><title>Minimal Form Demonstration</title>
</head><body>
<pre>
<b>x</b>: <i>a</i>
<b>y</b>: <i>b</i>
</pre>
</body></html>
EOF
REQUEST_METHOD=GET QUERY_STRING='' HTTP_COOKIE='' ./test_cookie > tmp5
diff tmp5 - <<EOF
Number of cookies= 0
Value of cookie "problem":
EOF
REQUEST_METHOD=GET QUERY_STRING='' HTTP_COOKIE='first=1;second=2' ./test_cookie > tmp6
diff tmp6 - <<EOF
Number of cookies= 2
Value of first cookie: 1
Value of cookie "problem":
EOF
./test_encode > tmp7 <<EOF
a&b+c%d;e f<g>h"i j%20k-_.!~*'()l
EOF
diff tmp7 - <<EOF
Type in test text and press return.
Enter a blank line when finished.
33: a&b+c%d;e f<g>h"i j%20k-_.!~*'()l
HTML Encoding:a&b+c%d;e f<g>h"i j%20k-_.!~*'()l
URL Encoding:a%26b%2Bc%25d%3Be%09f%3Cg%3Eh%22i%20j%2520k-_.!~*'()l
URL Decoding:a&b c%d;e f<g>h"i j k-_.!~*'()l
EOF
|