summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Grabmüller <mgrabmue@cs.tu-berlin.de>2001-07-27 16:11:13 +0000
committerMartin Grabmüller <mgrabmue@cs.tu-berlin.de>2001-07-27 16:11:13 +0000
commit024001c213e229f9a6ba0066184f59349559003a (patch)
tree9c7613f25394238f09275efebd88194070abe8bf
parenta0f5718e1556066cc536a7871529dc077b70a594 (diff)
Check in forgotten test scripts.
-rwxr-xr-xexamples/box-dynamic-module/check.test48
-rwxr-xr-xexamples/box-dynamic/check.test38
-rwxr-xr-xexamples/box-module/check.test38
-rwxr-xr-xexamples/box/check.test38
-rwxr-xr-xexamples/modules/check.test27
-rwxr-xr-xexamples/safe/check.test40
-rwxr-xr-xexamples/scripts/check.test53
7 files changed, 282 insertions, 0 deletions
diff --git a/examples/box-dynamic-module/check.test b/examples/box-dynamic-module/check.test
new file mode 100755
index 000000000..935176d20
--- /dev/null
+++ b/examples/box-dynamic-module/check.test
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+# must be run from this directory
+guile=${GUILE-../../libguile/guile}
+
+set -e
+
+#
+# ./box test #1
+#
+$guile -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline)))' > TMP
+cat <<EOF | diff -u - TMP
+#<box #f>
+EOF
+rm -f TMP
+
+#
+# ./box test #2
+#
+$guile -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline)))' > TMP
+cat <<EOF | diff -u - TMP
+#<box #f>
+#<box 1>
+EOF
+rm -f TMP
+
+#
+# ./box test #3
+#
+$guile -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline) (display (box-ref b)) (newline)))' > TMP
+cat <<EOF | diff -u - TMP
+#<box #f>
+#<box 1>
+1
+EOF
+rm -f TMP
+
+#
+# ./box test #4
+#
+$guile -c '(begin (use-modules (box-mixed)) (let ((b (make-box-list 1 2 3))) (display b) (newline) (display (box-map 1+ b)) (newline)))' > TMP
+cat <<EOF | diff -u - TMP
+(#<box 1> #<box 2> #<box 3>)
+(#<box 2> #<box 3> #<box 4>)
+EOF
+rm -f TMP
+
+# check.test ends here
diff --git a/examples/box-dynamic/check.test b/examples/box-dynamic/check.test
new file mode 100755
index 000000000..c0923365c
--- /dev/null
+++ b/examples/box-dynamic/check.test
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# must be run from this directory
+guile=${GUILE-../../libguile/guile}
+
+set -e
+
+#
+# ./box test #1
+#
+$guile -c '(begin (load-extension "libbox" "scm_init_box") (let ((b (make-box))) (display b) (newline)))' > TMP
+cat <<EOF | diff -u - TMP
+#<box #f>
+EOF
+rm -f TMP
+
+#
+# ./box test #2
+#
+$guile -c '(begin (load-extension "libbox" "scm_init_box") (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline)))' > TMP
+cat <<EOF | diff -u - TMP
+#<box #f>
+#<box 1>
+EOF
+rm -f TMP
+
+#
+# ./box test #3
+#
+$guile -c '(begin (load-extension "libbox" "scm_init_box") (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline) (display (box-ref b)) (newline)))' > TMP
+cat <<EOF | diff -u - TMP
+#<box #f>
+#<box 1>
+1
+EOF
+rm -f TMP
+
+# check.test ends here
diff --git a/examples/box-module/check.test b/examples/box-module/check.test
new file mode 100755
index 000000000..28a79d45b
--- /dev/null
+++ b/examples/box-module/check.test
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# must be run from this directory
+guile=${GUILE-../../libguile/guile}
+
+set -e
+
+#
+# ./box test #1
+#
+./box -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline)))' > TMP
+cat <<EOF | diff -u - TMP
+#<box #f>
+EOF
+rm -f TMP
+
+#
+# ./box test #2
+#
+./box -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline)))' > TMP
+cat <<EOF | diff -u - TMP
+#<box #f>
+#<box 1>
+EOF
+rm -f TMP
+
+#
+# ./box test #3
+#
+./box -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline) (display (box-ref b)) (newline)))' > TMP
+cat <<EOF | diff -u - TMP
+#<box #f>
+#<box 1>
+1
+EOF
+rm -f TMP
+
+# check.test ends here
diff --git a/examples/box/check.test b/examples/box/check.test
new file mode 100755
index 000000000..1909ffb7e
--- /dev/null
+++ b/examples/box/check.test
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# must be run from this directory
+guile=${GUILE-../../libguile/guile}
+
+set -e
+
+#
+# ./box test #1
+#
+./box -c '(let ((b (make-box))) (display b) (newline))' > TMP
+cat <<EOF | diff -u - TMP
+#<box #f>
+EOF
+rm -f TMP
+
+#
+# ./box test #2
+#
+./box -c '(let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline))' > TMP
+cat <<EOF | diff -u - TMP
+#<box #f>
+#<box 1>
+EOF
+rm -f TMP
+
+#
+# ./box test #3
+#
+./box -c '(let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline) (display (box-ref b)) (newline))' > TMP
+cat <<EOF | diff -u - TMP
+#<box #f>
+#<box 1>
+1
+EOF
+rm -f TMP
+
+# check.test ends here
diff --git a/examples/modules/check.test b/examples/modules/check.test
new file mode 100755
index 000000000..f7a789b69
--- /dev/null
+++ b/examples/modules/check.test
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# must be run from this directory
+guile=${GUILE-../../libguile/guile}
+
+if test "X$srcdir" = X; then
+ srcdir=.
+fi
+
+set -e
+
+#
+# ./main test
+#
+$guile -s $srcdir/main > TMP
+cat <<EOF | diff -u - TMP
+module-0 foo
+module-0 bar
+module-1 foo
+module-1 bar
+module-2 braz
+module-2 braz
+module-2 foo
+EOF
+rm -f TMP
+
+# check.test ends here
diff --git a/examples/safe/check.test b/examples/safe/check.test
new file mode 100755
index 000000000..9e5f192d8
--- /dev/null
+++ b/examples/safe/check.test
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# must be run from this directory
+guile=${GUILE-../../libguile/guile}
+
+if test "X$srcdir" = X; then
+ srcdir=.
+fi
+
+set -e
+
+#
+# ./safe untrusted.scm
+#
+$guile -s $srcdir/safe $srcdir/untrusted.scm > TMP
+cat <<EOF | diff -u - TMP
+1
+1
+2
+6
+24
+120
+720
+5040
+40320
+362880
+3628800
+EOF
+rm -f TMP
+
+#
+# ./safe evil.scm
+#
+$guile -s $srcdir/safe $srcdir/evil.scm > TMP
+cat <<EOF | diff -u - TMP
+** Exception: (unbound-variable #f "Unbound variable: ~S" (open-input-file) #f)
+EOF
+rm -f TMP
+
+# check.test ends here
diff --git a/examples/scripts/check.test b/examples/scripts/check.test
new file mode 100755
index 000000000..2a3e753d6
--- /dev/null
+++ b/examples/scripts/check.test
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# must be run from this directory
+guile=${GUILE-../../libguile/guile}
+if [ -x $guile ] ; then
+ :
+else
+ echo could not find guile interpreter.
+ echo '(are you running this script from' `dirname $0` '?)'
+ echo GUILE env var: ${GUILE-not set}
+ exit 1
+fi
+
+if test "X$srcdir" = X; then
+ srcdir=.
+fi
+
+set -e
+
+#
+# simple-hello.scm
+#
+$guile -s $srcdir/simple-hello.scm > TMP
+cat <<EOF | diff -u - TMP
+Hello, World!
+EOF
+rm -f TMP
+
+#
+# hello
+#
+$guile -s $srcdir/hello > TMP
+echo "Hello, World!" | diff -u - TMP
+rm -f TMP
+
+$guile -s $srcdir/hello --version > TMP
+echo "hello 0.0.1" | diff -u - TMP
+rm -f TMP
+
+$guile -s $srcdir/hello --help > TMP
+cat <<EOF | diff -u - TMP
+Usage: hello [options...]
+ --help, -h Show this usage information
+ --version, -v Show version information
+EOF
+rm -f TMP
+
+#
+# fact
+#
+case `$guile -s $srcdir/fact 5` in 120) ;; *) echo $0: error: fact 5 ;; esac
+
+# check.test ends here