git @ Cat's Eye Technologies Falderal / d64bc32
Make test.sh self-contained, and have it clean up after itself. catseye 13 years ago
2 changed file(s) with 55 addition(s) and 50 deletion(s). Raw diff Collapse all Expand all
+0
-50
expected.txt less more
0 --------------------------------
1 Total tests: 17, failures: 5
2 --------------------------------
3
4 FAILED:
5 This is an intentionally failing test, to demonstrate how Falderal will
6 present it.
7
8 Input : Something
9 Expected: Output "Anything"
10 Actual : Output "oehn"
11
12 FAILED:
13 Another intentionally failing test to demonstrate how Falderal will
14 present expecting an exception and not getting one.
15
16 Input : ridiculous
17 Expected: Exception "Prelude.head: empty list"
18 Actual : Output "iiuos"
19
20 FAILED:
21 An intentionally failing test to demonstrate that it is important
22 to get the formatting of the output right, when testing with show.
23
24 Input : 01
25 Expected: Output "[False, True]"
26 Actual : Output "[False,True]"
27
28 FAILED:
29 An intentionally failing test to demonstrate show what a failure
30 looks like on multi-line input.
31
32 Input:
33 01
34 10
35 Expected: Output "[False,False,True,True]"
36 Actual : Output "[False,True,True,False]"
37
38 FAILED:
39 (#3) If we have a set of tests where the tests after the first one have no
40 descriptions of their own, we can take this to suggest they are all
41 testing the same thing. In this case, the literal text that is displayed
42 when any of them fails is the text that comes before the first of them,
43 annotated with the number of the test in the set that failed. The
44 intentionally-failing third test below demonstrates this.
45
46 Input : 0000
47 Expected: Output "[False,False,False,Flse]"
48 Actual : Output "[False,False,False,False]"
49
11
22 # A tiny test harness for Falderal itself.
33
4 cat >expected.txt <<EOF
5 --------------------------------
6 Total tests: 17, failures: 5
7 --------------------------------
8
9 FAILED:
10 This is an intentionally failing test, to demonstrate how Falderal will
11 present it.
12
13 Input : Something
14 Expected: Output "Anything"
15 Actual : Output "oehn"
16
17 FAILED:
18 Another intentionally failing test to demonstrate how Falderal will
19 present expecting an exception and not getting one.
20
21 Input : ridiculous
22 Expected: Exception "Prelude.head: empty list"
23 Actual : Output "iiuos"
24
25 FAILED:
26 An intentionally failing test to demonstrate that it is important
27 to get the formatting of the output right, when testing with show.
28
29 Input : 01
30 Expected: Output "[False, True]"
31 Actual : Output "[False,True]"
32
33 FAILED:
34 An intentionally failing test to demonstrate show what a failure
35 looks like on multi-line input.
36
37 Input:
38 01
39 10
40 Expected: Output "[False,False,True,True]"
41 Actual : Output "[False,True,True,False]"
42
43 FAILED:
44 (#3) If we have a set of tests where the tests after the first one have no
45 descriptions of their own, we can take this to suggest they are all
46 testing the same thing. In this case, the literal text that is displayed
47 when any of them fails is the text that comes before the first of them,
48 annotated with the number of the test in the set that failed. The
49 intentionally-failing third test below demonstrates this.
50
51 Input : 0000
52 Expected: Output "[False,False,False,Flse]"
53 Actual : Output "[False,False,False,False]"
54
55 EOF
456 ghc Test/Falderal/Demo.lhs -e test >actual.txt
557 diff -u expected.txt actual.txt
58 E=$?
59 rm -f expected.txt actual.txt
60 exit $E