Stage one clean up of test files. Some unit tests are still creating temporary files in

the project root directory, which is still to be fixed; and *I think* known-failing
tests which I don't intend to fix immediately should be marked in some way.
This commit is contained in:
Simon Brooke 2026-02-14 14:04:41 +00:00
parent 5e6363e6ae
commit 222368bf64
28 changed files with 172 additions and 144 deletions

View file

@ -11,6 +11,8 @@ TESTS := $(shell find unit-tests -name *.sh)
INC_DIRS := $(shell find $(SRC_DIRS) -type d)
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
TMP_DIR ?= ./tmp
INDENT_FLAGS := -nbad -bap -nbc -br -brf -brs -c33 -cd33 -ncdb -ce -ci4 -cli4 \
-d0 -di1 -nfc1 -i4 -ip0 -l75 -lp -npcs \
-npsl -nsc -nsob -nss -nut -prs -l79 -ts2
@ -41,7 +43,7 @@ test: $(TESTS) Makefile $(TARGET)
.PHONY: clean
clean:
$(RM) $(TARGET) $(OBJS) $(DEPS) $(SRC_DIRS)/*~ $(SRC_DIRS)/*/*~ *~ core
$(RM) $(TARGET) $(OBJS) $(DEPS) $(SRC_DIRS)/*~ $(SRC_DIRS)/*/*~ $(TMP_DIR)/* *~ core
repl:
$(TARGET) -p 2> psse.log

View file

@ -412,10 +412,16 @@ struct cons_pointer multiply_integers( struct cons_pointer a,
struct cons_pointer integer_to_string_add_digit( int digit, int digits,
struct cons_pointer tail ) {
wint_t character = btowc( hex_digits[digit] );
return ( digits % 3 == 0 ) ?
debug_printf( DEBUG_IO, L"integer_to_string_add_digit: digit is %d, digits is %d; returning: ", digit, digits);
struct cons_pointer r = ( digits % 3 == 0 ) ?
make_string( L',', make_string( character,
tail ) ) :
make_string( character, tail );
debug_print_object( r, DEBUG_IO);
debug_println( DEBUG_IO);
return r;
}
/**

View file

@ -170,13 +170,9 @@ struct cons_pointer print( URL_FILE * output, struct cons_pointer pointer ) {
url_fputwc( L'>', output );
break;
case INTEGERTV:
if ( nilp( cell.payload.integer.more)) {
url_fwprintf( output, L"%ld", cell.payload.integer.value);
} else {
struct cons_pointer s = integer_to_string( pointer, 10 );
print_string_contents( output, s );
dec_ref( s );
}
struct cons_pointer s = integer_to_string( pointer, 10 );
print_string_contents( output, s );
dec_ref( s );
break;
case KEYTV:
url_fputws( L":", output );

View file

@ -18,7 +18,6 @@ echo -n "$0: Apply function to multiple arguments... "
expected='3'
actual=`echo "(apply 'add '(1 2))"| target/psse 2>/dev/null | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"

View file

@ -9,7 +9,7 @@ a=1152921504606846975
b=1
c=`echo "$a + $b" | bc`
expected='t'
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>psse.log`
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>tmp/psse.log`
actual=`echo $output |\
tail -1`
@ -23,8 +23,8 @@ else
return=`echo "${return} + 1" | bc`
fi
echo -n "checking no bignum was created: "
grep -v 'BIGNUM!' psse.log > /dev/null
echo -n "$0: checking no bignum was created: "
grep -v 'BIGNUM!' tmp/psse.log > /dev/null
if [ $? -eq "0" ]
then
echo "OK"
@ -40,7 +40,7 @@ a='1152921504606846976'
b=1
c=`echo "$a + $b" | bc`
expected='t'
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>psse.log`
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>tmp/psse.log`
actual=`echo $output |\
tail -1 |\
@ -56,7 +56,7 @@ else
fi
echo -n "$0 => checking a bignum was created: "
grep 'BIGNUM!' psse.log > /dev/null
grep 'BIGNUM!' tmp/psse.log > /dev/null
if [ $? -eq "0" ]
then
echo "OK"
@ -73,7 +73,7 @@ a='1152921504606846977'
b=1
c=`echo "$a + $b" | bc`
expected='t'
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>psse.log`
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>tmp/psse.log`
actual=`echo $output |\
tail -1 |\
@ -89,7 +89,7 @@ else
fi
echo -n "$0 => checking a bignum was created: "
grep 'BIGNUM!' psse.log > /dev/null
grep 'BIGNUM!' tmp/psse.log > /dev/null
if [ $? -eq "0" ]
then
echo "OK"
@ -106,7 +106,7 @@ a=1
b=1152921504606846977
c=`echo "$a + $b" | bc`
expected='t'
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>psse.log`
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>tmp/psse.log`
actual=`echo $output |\
tail -1 |\
@ -121,8 +121,8 @@ else
return=`echo "${return} + 1" | bc`
fi
echo -n "checking a bignum was created: "
grep 'BIGNUM!' psse.log > /dev/null
echo -n "$0 => checking a bignum was created: "
grep 'BIGNUM!' tmp/psse.log > /dev/null
if [ $? -eq "0" ]
then
echo "OK"
@ -139,7 +139,7 @@ a=1152921504606846977
c=`echo "$a + $a" | bc`
echo -n "$0 => adding $a to $a: "
expected='t'
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>psse.log`
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>tmp/psse.log`
actual=`echo $output |\
tail -1 |\
@ -160,7 +160,7 @@ a=1152921504606846977
c=`echo "$a * 5" | bc`
echo -n "$0 => adding $a, $a $a, $a, $a: "
expected='t'
output=`echo "(= (+ $a $a $a $a $a) $c)" | target/psse -v 2 2>psse.log`
output=`echo "(= (+ $a $a $a $a $a) $c)" | target/psse -v 2 2>tmp/psse.log`
actual=`echo $output |\
tail -1 |\
@ -183,7 +183,7 @@ a=10000000000000000000
b=10000000000000000000
c=`echo "$a + $b" | bc`
expected='t'
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>psse.log`
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>tmp/psse.log`
actual=`echo $output |\
tail -1 |\
@ -199,7 +199,7 @@ else
fi
echo -n "$0 => checking a bignum was created: "
grep 'BIGNUM!' psse.log > /dev/null
grep 'BIGNUM!' tmp/psse.log > /dev/null
if [ $? -eq "0" ]
then
echo "OK"
@ -216,7 +216,7 @@ a=1
b=1329227995784915872903807060280344576
c=`echo "$a + $b" | bc`
expected='t'
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>psse.log`
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>tmp/psse.log`
actual=`echo $output |\
tail -1 |\
@ -232,7 +232,7 @@ else
fi
echo -n "$0 => checking a bignum was created: "
grep 'BIGNUM!' psse.log > /dev/null
grep 'BIGNUM!' tmp/psse.log > /dev/null
if [ $? -eq "0" ]
then
echo "OK"
@ -250,7 +250,7 @@ a=1
b=3064991081731777716716694054300618367237478244367204352
c=`echo "$a + $b" | bc`
expected='t'
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>psse.log`
output=`echo "(= (+ $a $b) $c)" | target/psse -v 2 2>tmp/psse.log`
actual=`echo $output |\
tail -1 |\
@ -266,7 +266,7 @@ else
fi
echo -n "$0 => checking a bignum was created: "
grep 'BIGNUM!' psse.log > /dev/null
grep 'BIGNUM!' tmp/psse.log > /dev/null
if [ $? -eq "0" ]
then
echo "OK"

View file

@ -1,6 +1,6 @@
#!/bin/bash
return=0
result=0
#####################################################################
# subtract a smallnum from a smallnum to produce a smallnum
@ -20,17 +20,17 @@ then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
return=1
result=`echo "${result} + 1" | bc`
fi
echo -n "checking no bignum was created: "
echo -n "$0 => checking no bignum was created: "
grep -v 'BIGNUM!' psse.log > /dev/null
if [ $? -eq "0" ]
then
echo "OK"
else
echo "Fail"
return=1
result=`echo "${result} + 1" | bc`
fi
#####################################################################
@ -51,7 +51,7 @@ then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
return=1
result=`echo "${result} + 1" | bc`
fi
#####################################################################
@ -71,7 +71,7 @@ then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
return=1
result=`echo "${result} + 1" | bc`
fi
@ -93,7 +93,7 @@ then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
return=1
result=`echo "${result} + 1" | bc`
fi
#####################################################################
@ -113,7 +113,7 @@ then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
return=1
result=`echo "${result} + 1" | bc`
fi
exit ${return}
exit ${result}

View file

@ -1,7 +1,7 @@
#!/bin/bash
expected='(1 2 3 ("Fred") nil 77,354)'
actual=`echo "'(1 2 3 (\"Fred\") () 77354)" | target/psse | tail -1`
actual=`echo "'(1 2 3 (\"Fred\") () 77354)" | target/psse 2>/dev/null | tail -1`
if [ "${expected}" = "${actual}" ]
then

View file

@ -12,7 +12,7 @@ then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=1
result=`echo "${result} + 1" | bc`
fi
echo -n "$0: cond with two clauses... "
@ -25,7 +25,7 @@ then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=1
result=`echo "${result} + 1" | bc`
fi
exit ${result}

View file

@ -2,26 +2,28 @@
result=0
echo -n "$0: let with two bindings, one form in body..."
expected='11'
actual=`echo "(let ((a . 5)(b . 6)) (+ a b))" | target/psse | tail -1`
actual=`echo "(let ((a . 5)(b . 6)) (+ a b))" | target/psse 2>/dev/null | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '$expected', got '$actual'"
result=1
result=`echo "${result} + 1" | bc`
fi
echo -n "$0: let with two bindings, two forms in body..."
expected='1'
actual=`echo "(let ((a . 5)(b . 6)) (+ a b) (- b a))" | target/psse | tail -1`
actual=`echo "(let ((a . 5)(b . 6)) (+ a b) (- b a))" | target/psse 2>/dev/null | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '$expected', got '$actual'"
result=1
result=`echo "${result} + 1" | bc`
fi
exit ${result}

View file

@ -1,42 +0,0 @@
#!/bin/bash
result=0
expected="(0 1 2 3 4 5 6 7 8 9 a b c d e f)"
actual=`echo "(list 0 1 2 3 4 5 6 7 8 9 'a 'b 'c 'd 'e 'f)" | target/psse | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '$expected', got '$actual'"
result=1
fi
expected="(0 1 2 3 4)"
actual=`echo "(list 0 1 2 3 4)" | target/psse | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '$expected', got '$actual'"
result=1
fi
expected="(0 1 2 3 4 5 6 7)"
actual=`echo "(list 0 1 2 3 4 5 6 7)" | target/psse | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
exit 0
else
echo "Fail: expected '$expected', got '$actual'"
result=1
fi
exit ${result}

47
unit-tests/list-test.sh Normal file
View file

@ -0,0 +1,47 @@
#!/bin/bash
result=0
echo -n "$0: flat list with 16 elements... "
expected="(0 1 2 3 4 5 6 7 8 9 a b c d e f)"
actual=`echo "(list 0 1 2 3 4 5 6 7 8 9 'a 'b 'c 'd 'e 'f)" |\
target/psse 2>/dev/null |\
tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '$expected', got '$actual'"
result=`echo "${result} + 1" | bc`
fi
echo -n "$0: flat list with 5 elements... "
expected="(0 1 2 3 4)"
actual=`echo "(list 0 1 2 3 4)" | target/psse 2>/dev/null | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '$expected', got '$actual'"
result=`echo "${result} + 1" | bc`
fi
echo -n "$0: flat list with 8 elements... "
expected="(0 1 2 3 4 5 6 7)"
actual=`echo "(list 0 1 2 3 4 5 6 7)" | target/psse 2>/dev/null | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
exit 0
else
echo "Fail: expected '$expected', got '$actual'"
result=`echo "${result} + 1" | bc`
fi
exit ${result}

View file

@ -1,28 +1,30 @@
#!/bin/bash
result=1
result=0
echo -n "$0: plus with fifteen arguments... "
expected="120"
actual=`echo "(+ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)" | target/psse | tail -1`
actual=`echo "(+ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)" | target/psse 2>/dev/null | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=1
result=`echo "${result} + 1" | bc`
fi
# check that all the args are actually being evaluated...
echo -n "$0: check that all the args are actually being evaluated... "
expected="120"
actual=`echo "(+ (+ 0 1) (+ 0 2) (+ 0 3) (+ 0 4) (+ 0 5) (+ 0 6) (+ 0 7) (+ 0 8) (+ 0 9) (+ 0 10) (+ 0 11) (+ 0 12) (+ 0 13) (+ 0 14 ) (+ 0 15))" | target/psse | tail -1`
actual=`echo "(+ (+ 0 1) (+ 0 2) (+ 0 3) (+ 0 4) (+ 0 5) (+ 0 6) (+ 0 7) (+ 0 8) (+ 0 9) (+ 0 10) (+ 0 11) (+ 0 12) (+ 0 13) (+ 0 14 ) (+ 0 15))" | target/psse 2>/dev/null | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=1
result=`echo "${result} + 1" | bc`
fi
return ${result}
exit ${result}

View file

@ -5,9 +5,9 @@ result=0
#####################################################################
# Create an empty map using map notation
expected='{}'
actual=`echo "$expected" | target/psse | tail -1`
actual=`echo "$expected" | target/psse 2>/dev/null | tail -1`
echo -n "Empty map using compact map notation: "
echo -n "$0: Empty map using compact map notation... "
if [ "${expected}" = "${actual}" ]
then
echo "OK"
@ -19,7 +19,7 @@ fi
#####################################################################
# Create an empty map using make-map
expected='{}'
actual=`echo "(hashmap)" | target/psse | tail -1`
actual=`echo "(hashmap)" | target/psse 2>/dev/null | tail -1`
echo -n "Empty map using (make-map): "
if [ "${expected}" = "${actual}" ]
@ -35,9 +35,9 @@ fi
# significant at this stage, but in the long term should be sorted
# alphanumerically
expected='{:one 1, :two 2, :three 3}'
actual=`echo "{:one 1 :two 2 :three 3}" | target/psse | tail -1`
actual=`echo "{:one 1 :two 2 :three 3}" | target/psse 2>/dev/null | tail -1`
echo -n "Map using map notation: "
echo -n "$0: Map using map notation... "
if [ "${expected}" = "${actual}" ]
then
echo "OK"
@ -51,9 +51,10 @@ fi
# significant at this stage, but in the long term should be sorted
# alphanumerically
expected='{:one 1, :two 2, :three 3}'
actual=`echo "(hashmap nil nil '((:one . 1)(:two . 2)(:three . 3)))" | target/psse | tail -1`
actual=`echo "(hashmap nil nil '((:one . 1)(:two . 2)(:three . 3)))" |\
target/psse 2>/dev/null | tail -1`
echo -n "Map using (hashmap): "
echo -n "$0: Map using (hashmap) with arguments... "
if [ "${expected}" = "${actual}" ]
then
echo "OK"
@ -65,9 +66,9 @@ fi
#####################################################################
# Keyword in function position
expected='2'
actual=`echo "(:two {:one 1 :two 2 :three 3})" | target/psse | tail -1`
actual=`echo "(:two {:one 1 :two 2 :three 3})" | target/psse 2>/dev/null | tail -1`
echo -n "Keyword in function position: "
echo -n "$0: Keyword in function position... "
if [ "${expected}" = "${actual}" ]
then
echo "OK"
@ -80,9 +81,9 @@ fi
#####################################################################
# Map in function position
expected='2'
actual=`echo "({:one 1 :two 2 :three 3} :two)" | target/psse | tail -1`
actual=`echo "({:one 1 :two 2 :three 3} :two)" | target/psse 2>/dev/null | tail -1`
echo -n "Map in function position: "
echo -n "$0: Map in function position... "
if [ "${expected}" = "${actual}" ]
then
echo "OK"

View file

@ -2,26 +2,30 @@
result=0
echo -n "$0: multiply two integers... "
expected='6'
actual=`echo "(multiply 2 3)" | target/psse | tail -1`
actual=`echo "(multiply 2 3)" | target/psse 2>/dev/null | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=1
result=`echo "${result} + 1" | bc`
fi
echo -n "$0: multiply a real by an integer... "
expected='7.5'
actual=`echo "(multiply 2.5 3)" | target/psse | tail -1`
actual=`echo "(multiply 2.5 3)" | target/psse 2>/dev/null | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=1
result=`echo "${result} + 1" | bc`
fi
exit ${result}

View file

@ -1,7 +1,7 @@
#!/bin/bash
expected=nil
actual=`echo 'nil' | target/psse | tail -1`
actual=`echo 'nil' | target/psse 2>/dev/null | tail -1`
if [ "${expected}" = "${actual}" ]
then

View file

@ -4,8 +4,9 @@ result=0
#####################################################################
# Create a path from root using compact path notation
echo -n "$0: Create a path from root using compact path notation... "
expected='(-> oblist :users :simon :functions (quote assoc))'
actual=`echo "'/:users:simon:functions/assoc" | target/psse | tail -1`
actual=`echo "'/:users:simon:functions/assoc" | target/psse 2>&1 | tail -1`
echo -n "Path from root (oblist) using compact notation: "
if [ "${expected}" = "${actual}" ]
@ -13,21 +14,21 @@ then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=1
result=`echo "${result} + 1" | bc`
fi
#####################################################################
# Create a path from the current session using compact path notation
echo -n "$0: Create a path from the current session using compact path notation... "
expected='(-> session :input-stream)'
actual=`echo "'$:input-stream" | target/psse | tail -1`
actual=`echo "'$:input-stream" | target/psse 2>/dev/null | tail -1`
echo -n "Path from current session using compact notation: "
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=1
result=`echo "${result} + 1" | bc`
fi
exit ${result}

View file

@ -2,26 +2,28 @@
result=0
echo -n "$0: progn with one form... "
expected='5'
actual=`echo "(progn (add 2 3))" | target/psse | tail -1`
actual=`echo "(progn (add 2 3))" | target/psse 2>/dev/null | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=1
result=`echo "${result} + 1" | bc`
fi
echo -n "$0: progn with two forms... "
expected='"foo"'
actual=`echo "(progn (add 2.5 3) \"foo\")" | target/psse | tail -1`
actual=`echo "(progn (add 2.5 3) \"foo\")" | target/psse 2>/dev/null | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=1
result=`echo "${result} + 1" | bc`
fi
exit ${result}

View file

@ -1,7 +1,7 @@
#!/bin/bash
expected='Fred'
actual=`echo "'Fred" | target/psse | tail -1`
actual=`echo "'Fred" | target/psse 2>&1 | tail -1`
if [ "${expected}" = "${actual}" ]
then

View file

@ -1,7 +1,7 @@
#!/bin/bash
expected='(123 (4 (5 nil)) Fred)'
actual=`echo "'(123 (4 (5 ())) Fred)" | target/psse | tail -1`
actual=`echo "'(123 (4 (5 ())) Fred)" | target/psse 2>&1 | tail -1`
if [ "${expected}" = "${actual}" ]
then

View file

@ -1,7 +1,7 @@
#!/bin/bash
expected='1/4'
actual=`echo "(+ 3/14 1/28)" | target/psse | tail -1`
actual=`echo "(+ 3/14 1/28)" | target/psse 2>&1 | tail -1`
if [ "${expected}" = "${actual}" ]
then

View file

@ -2,30 +2,33 @@
result=0
echo -n "$0: reverse a string... "
expected='"god yzal eht revo depmuj xof nworb kciuq ehT"'
actual=`echo '(reverse "The quick brown fox jumped over the lazy dog")' | target/psse | tail -1`
actual=`echo '(reverse "The quick brown fox jumped over the lazy dog")' | target/psse 2>&1 | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=1
result=`echo "${result} + 1" | bc`
fi
echo -n "$0: reverse a list... "
expected='(1,024 512 256 128 64 32 16 8 4 2)'
actual=`echo "(reverse '(2 4 8 16 32 64 128 256 512 1024))" | target/psse | tail -1`
actual=`echo "(reverse '(2 4 8 16 32 64 128 256 512 1024))" | target/psse 2>&1 | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=1
result=`echo "${result} + 1" | bc`
fi
echo -n "$0: reverse a symbol... "
expected='esrever'
actual=`echo "(reverse 'reverse)" | target/psse | tail -1`
actual=`echo "(reverse 'reverse)" | target/psse 2>&1 | tail -1`
if [ "${expected}" = "${actual}" ]
then
@ -33,8 +36,8 @@ then
exit 0
else
echo "Fail: expected '${expected}', got '${actual}'"
result=1
result=`echo "${result} + 1" | bc`
fi
echo ${result}
exit ${result}

View file

@ -1,7 +1,7 @@
#!/bin/bash
expected="(1 2 3)"
actual=`echo "'(1 2 3)" | target/psse | tail -1`
actual=`echo "'(1 2 3)" | target/psse 2>&1 | tail -1`
if [ "${expected}" = "${actual}" ]
then

View file

@ -1,9 +1,9 @@
#!/bin/bash
tmp=hi.$$
tmp=tmp/hi.$$
echo "Hello, there." > ${tmp}
expected='"Hello, there.'
actual=`echo "(slurp (open \"${tmp}\"))" | target/psse | tail -2 | head -1`
actual=`echo "(slurp (open \"${tmp}\"))" | target/psse 2>&1 | tail -2 | head -1`
if [ "${expected}" = "${actual}" ]
then

View file

@ -2,28 +2,28 @@
result=0
# We should be able to cons a single character string onto the front of a string
echo -n "$0: We should be able to cons a single character string onto the front of a string... "
expected='"Test"'
actual=`echo '(cons "T" "est")' | target/psse | tail -1`
actual=`echo '(cons "T" "est")' | target/psse 2>/dev/null | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=1
result=`echo "${result} + 1" | bc`
fi
# But if the first argument has more than one character, we should get a dotted pair
echo -n "$0: But if the first argument has more than one character, we should get a dotted pair... "
expected='("Test" . "pass")'
actual=`echo '(cons "Test" "pass")' | target/psse | tail -1`
actual=`echo '(cons "Test" "pass")' | target/psse 2>&1 | tail -1`
if [ "${expected}" = "${actual}" ]
then
echo "OK"
else
echo "Fail: expected '${expected}', got '${actual}'"
result=1
result=`echo "${result} + 1" | bc`
fi
exit ${result}

View file

@ -1,7 +1,7 @@
#!/bin/bash
expected='"Strings should be able to include spaces (and other stuff)!"'
actual=`echo ${expected} | target/psse | tail -1`
actual=`echo ${expected} | target/psse 2>&1 | tail -1`
if [ "${expected}" = "${actual}" ]
then

View file

@ -2,8 +2,9 @@
result=0
echo -n "$0: if the body of a try errors, the last form in the catch block is returned... "
expected=':foo'
actual=`echo "(try ((+ 2 (/ 1 'a))) (:foo))" | target/psse | tail -1`
actual=`echo "(try ((+ 2 (/ 1 'a))) (:foo))" | target/psse 2>&1 | tail -1`
if [ "${expected}" = "${actual}" ]
then
@ -13,8 +14,10 @@ else
return=`echo "${return} + 1" | bc`
fi
echo -n "$0: if the body of a try errors, the last form in the catch block is evaluated... "
expected='4'
actual=`echo "(try ((+ 2 (/ 1 'a))) ((+ 2 2)))" | target/psse | tail -1`
actual=`echo "(try ((+ 2 (/ 1 'a))) ((+ 2 2)))" | target/psse 2>&1 | tail -1`
if [ "${expected}" = "${actual}" ]
then
@ -24,8 +27,9 @@ else
return=`echo "${return} + 1" | bc`
fi
echo -n "$0: body and catch block can optionally be marked with keywords... "
expected='8'
actual=`echo "(try (:body (+ 2 (/ 1 'a))) (:catch (* 2 2 2)))" | target/psse | tail -1`
actual=`echo "(try (:body (+ 2 (/ 1 'a))) (:catch (* 2 2 2)))" | target/psse 2>&1 | tail -1`
if [ "${expected}" = "${actual}" ]
then
@ -35,8 +39,9 @@ else
return=`echo "${return} + 1" | bc`
fi
echo -n "$0: the exception is bound to the symbol \`*exception*\` in the catch environment... "
expected='Exception: "Cannot divide: not a number"'
actual=`echo "(try (:body (+ 2 (/ 1 'a))) (:catch *exception*))" | target/psse | grep Exception`
actual=`echo "(try (:body (+ 2 (/ 1 'a))) (:catch *exception*))" | target/psse 2>&1 | grep Exception`
if [ "${expected}" = "${actual}" ]
then

View file

@ -1,7 +1,7 @@
#!/bin/bash
expected='(1 2 3 4 5 6 7 8 9 10)'
actual=`echo "(set! list (lambda l l))(list 1 2 3 4 5 6 7 8 9 10)" |target/psse | tail -1`
actual=`echo "(set! list (lambda l l))(list 1 2 3 4 5 6 7 8 9 10)" | target/psse 2>&1 | tail -1`
if [ "${expected}" = "${actual}" ]
then

View file

@ -1,7 +1,7 @@
#!/bin/bash
expected='"λάμ(β)δα"'
actual=`echo $expected | target/psse | tail -1`
actual=`echo $expected | target/psse 2>&1 | tail -1`
if [ "${expected}" = "${actual}" ]
then