git @ Cat's Eye Technologies Hev / 59e7ded
Use the standard (for us) Haskell build and test approaches. Chris Pressey 7 years ago
6 changed file(s) with 63 addition(s) and 61 deletion(s). Raw diff Collapse all Expand all
0 *.hi
1 *.o
2 bin/*
0 syntax: glob
1
2 *.hi
3 *.o
4 bin/*
0 #!/bin/sh
1
2 PROG=hev
3
4 if [ x`which ghc` = x -a x`which runhugs` = x ]; then
5 echo "Neither ghc nor runhugs found on search path."
6 exit 1
7 fi
8
9 mkdir -p bin
10
11 if [ x`which ghc` = x -o ! x$USE_HUGS = x ]; then
12 # create script to run with Hugs
13 cat >bin/$PROG <<'EOF'
14 #!/bin/sh
15 THIS=`realpath $0`
16 DIR=`dirname $THIS`/../src
17 runhugs $DIR/Main.hs $*
18 EOF
19 chmod 755 bin/$PROG
20 else
21 cd src && ghc --make Main.hs -o ../bin/$PROG
22 fi
00 #!/bin/sh
11
2 if [ x`which ghc` = x -a x`which runhugs` = x ]; then
3 echo "Neither ghc nor runhugs found on search path"
4 exit 1
2 ./build.sh || exit 1
3
4 FILES="tests/Hev.markdown"
5 if [ x$USE_HUGS = x ]; then
6 FILES="$FILES tests/Internals.markdown"
57 fi
68
7 touch fixture.markdown
8 touch Internals.markdown
9
10 if [ ! x`which ghc` = x ]; then
11 cat >>fixture.markdown <<EOF
12 -> Functionality "Parse Hev Program" is implemented by
13 -> shell command
14 -> "ghc src/Hev.hs -e "parse \"%(test-body-text)\"""
15
16 -> Functionality "Compile Hev Program" is implemented by
17 -> shell command
18 -> "ghc src/Hev.hs -e "compile \"%(test-body-text)\"""
19
20 -> Functionality "Hev Binding" is implemented by
21 -> shell command
22 -> "ghc src/Hev.hs -e "getBinding \"%(test-body-text)\" (UnifierBinding \"-\" TreeLeaf (UnifierBinding \"+\" (TreeBranch TreeLeaf TreeLeaf) UnifierNil))""
23
24 -> Functionality "Hev Matching" is implemented by
25 -> shell command
26 -> "ghc src/Hev.hs -e "match %(test-body-text)""
27
28 -> Functionality "Hev Rewriting" is implemented by
29 -> shell command
30 -> "ghc src/Hev.hs -e "rewrite %(test-body-text)""
31
32 -> Functionality "Hev Execution" is implemented by
33 -> shell command
34 -> "ghc src/Hev.hs -e "run (compile \"%(test-body-text)\")""
35
36 EOF
37 cp tests/Internals.markdown .
38 fi
39
40 if [ ! x`which runhugs` = x ]; then
41 cat >>fixture.markdown <<EOF
42 -> Functionality "Parse Hev Program" is implemented by
43 -> shell command
44 -> "runhugs src/Main.hs parse %(test-body-file)"
45
46 -> Functionality "Compile Hev Program" is implemented by
47 -> shell command
48 -> "runhugs src/Main.hs compile %(test-body-file)"
49
50 -> Functionality "Hev Binding" is implemented by
51 -> shell command
52 -> "runhugs src/Main.hs getbinding %(test-body-file)"
53
54 -> Functionality "Hev Execution" is implemented by
55 -> shell command
56 -> "runhugs src/Main.hs run %(test-body-file)"
57
58 EOF
59 fi
60
61 falderal fixture.markdown Internals.markdown tests/Hev.markdown
62 RESULT=$?
63 rm -f fixture.markdown Internals.markdown
64 exit $RESULT
9 falderal $FILES
33 This test suite is written in the format of Falderal. It is far from
44 exhaustive, but provides a basic sanity check that the language we've
55 implemented comes close to Hev.
6
7 -> Functionality "Parse Hev Program" is implemented by
8 -> shell command
9 -> "bin/hev parse %(test-body-file)"
10
11 -> Functionality "Compile Hev Program" is implemented by
12 -> shell command
13 -> "bin/hev compile %(test-body-file)"
14
15 -> Functionality "Hev Binding" is implemented by
16 -> shell command
17 -> "bin/hev getbinding %(test-body-file)"
18
19 -> Functionality "Hev Execution" is implemented by
20 -> shell command
21 -> "bin/hev run %(test-body-file)"
622
723 Hev Parsing
824 -----------
00 Test Suite for Hev Internals
11 ============================
2
3 These tests are only run under ghc, not Hugs.
4
5 -> Functionality "Hev Matching" is implemented by
6 -> shell command
7 -> "ghc src/Hev.hs -e "match %(test-body-text)""
8
9 -> Functionality "Hev Rewriting" is implemented by
10 -> shell command
11 -> "ghc src/Hev.hs -e "rewrite %(test-body-text)""
212
313 Hev Matching
414 ------------