mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
Check in forgotten test scripts.
This commit is contained in:
parent
a0f5718e15
commit
024001c213
7 changed files with 282 additions and 0 deletions
48
examples/box-dynamic-module/check.test
Executable file
48
examples/box-dynamic-module/check.test
Executable file
|
@ -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
|
38
examples/box-dynamic/check.test
Executable file
38
examples/box-dynamic/check.test
Executable file
|
@ -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
|
38
examples/box-module/check.test
Executable file
38
examples/box-module/check.test
Executable file
|
@ -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
|
38
examples/box/check.test
Executable file
38
examples/box/check.test
Executable file
|
@ -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
|
27
examples/modules/check.test
Executable file
27
examples/modules/check.test
Executable file
|
@ -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
|
40
examples/safe/check.test
Executable file
40
examples/safe/check.test
Executable file
|
@ -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
|
53
examples/scripts/check.test
Executable file
53
examples/scripts/check.test
Executable file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue