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
|
#!/bin/sh
# Tests basic compiling and running.
# Tests state persistence across restarts.
# Tests custom configuration recompilation.
# Tests restarting a custom configuration.
# Tests compilation error reporting.
. ../subr.sh
### SETUP ###
mkdir -p working
cd working
### TEST A ###
cp ../Lib.hs ../Main.hs .
echo "attempting to make"
$HC --make Main.hs -o basic || die "compilation failed"
OUTPUT_A=`./basic --dyre-debug`
assert "$OUTPUT_A" "Basic Test Version 1.0 - 3" "A"
### TEST B ###
cp ../goodConfig.hs basicTest.hs
OUTPUT_B=`./basic --dyre-debug`
assert "$OUTPUT_B" "Basic Test Version 2.0 - 3" "B"
### TEST C ###
sleep 1
cp ../badConfig.hs basicTest.hs
OUTPUT_C=`./basic --dyre-debug`
assert "$OUTPUT_C" "Compile Error" "C"
### TEST D ###
# Now test that removing the custom config results in
# successful run of non-custom binary.
rm basicTest.hs
OUTPUT_D=`./basic --dyre-debug`
assert "$OUTPUT_D" "Basic Test Version 1.0 - 3" "D"
### TEST E ###
# Test use of modules under "$confdir/lib/"
cp ../moduleConfig.hs basicTest.hs
mkdir lib
cp ../MyConfig.hs lib/MyConfig.hs
OUTPUT_E=`./basic --dyre-debug`
assert "$OUTPUT_E" "Modules are great! - 3" "E"
### TEST F ###
# Test that changes to modules under "$confdir/lib/" trigger recompilation
cp ../moduleConfig.hs basicTest.hs
cp ../MyConfig-updated.hs lib/MyConfig.hs
OUTPUT_E=`./basic --dyre-debug`
assert "$OUTPUT_E" "Modules are still great! - 3" "E"
### TEARDOWN ###
echo "Passed"
cd ..
rm -r working
|