All tests pass once again!
Chris Pressey
9 years ago
1 | 1 |
|
2 | 2 |
# Really crude test harness for py-falderal itself...
|
3 | 3 |
|
4 | |
bin/falderal -t || exit 1
|
|
4 |
bin/falderal -v -t || exit 1
|
5 | 5 |
|
6 | 6 |
cd tests
|
7 | 7 |
|
8 | 8 |
FIRST_TESTS="
|
9 | |
test1 test2 test3 test4 test5
|
|
9 |
test-pass-fail test-no-functionality test-ill-formed
|
|
10 |
test4 test5
|
10 | 11 |
test-utf8 test-crlf
|
11 | 12 |
test-bad-indentation
|
12 | 13 |
test-input-sections test-shared-body
|
|
0 |
--------------------------------
|
|
1 |
Total test runs: 0, failures: 0
|
|
2 |
--------------------------------
|
|
0 |
Falderal Test: Bad indentation
|
|
1 |
------------------------------
|
|
2 |
|
|
3 |
Since these blocks are not indented correctly, `py-falderal` should not
|
|
4 |
load tests from them. (Ideally it should produce warnings though.)
|
|
5 |
|
|
6 |
-> Functionality "Cat" is implemented by
|
|
7 |
-> shell command "python cat.py"
|
|
8 |
|
|
9 |
Cat cats.
|
|
10 |
|
|
11 |
| meow
|
|
12 |
= meow
|
|
13 |
|
|
14 |
| purr
|
|
15 |
| prrr
|
|
16 |
| prreow
|
|
17 |
= purr
|
|
18 |
= prrr
|
|
19 |
= prreow
|
|
0 |
FalderalSyntaxError: line 13: test body must be followed by expectation or test input
|
|
0 |
Falderal Test: ill-formed
|
|
1 |
-------------------------
|
|
2 |
|
|
3 |
A Falderal document which is ill-formed.
|
|
4 |
|
|
5 |
-> Functionality "Cat" is implemented by
|
|
6 |
-> shell command "python cat.py"
|
|
7 |
|
|
8 |
-> Tests for functionality "Cat"
|
|
9 |
|
|
10 |
Cat cats.
|
|
11 |
|
|
12 |
| meow
|
|
13 |
|
|
14 |
Oops, I didn't include an expectation.
|
|
0 |
--------------------------------
|
|
1 |
Total test runs: 5, failures: 0
|
|
2 |
--------------------------------
|
|
0 |
Falderal Test: Input sections
|
|
1 |
-----------------------------
|
|
2 |
|
|
3 |
Test tests that have test input sections.
|
|
4 |
|
|
5 |
-> Functionality "Silly Interpreter" is implemented by
|
|
6 |
-> shell command "python silly-interpreter.py %(test-body-file)"
|
|
7 |
|
|
8 |
-> Tests for functionality "Silly Interpreter"
|
|
9 |
|
|
10 |
| print x
|
|
11 |
=
|
|
12 |
|
|
13 |
| read x
|
|
14 |
| print x
|
|
15 |
+ meow
|
|
16 |
= meow
|
|
17 |
|
|
18 |
| read x
|
|
19 |
| print x
|
|
20 |
+ purr
|
|
21 |
= purr
|
|
22 |
|
|
23 |
| read x
|
|
24 |
| print x
|
|
25 |
| read y
|
|
26 |
| print y
|
|
27 |
+ meow
|
|
28 |
+ purr
|
|
29 |
= meow
|
|
30 |
= purr
|
|
31 |
|
|
32 |
| read x
|
|
33 |
| read y
|
|
34 |
| print y
|
|
35 |
| print x
|
|
36 |
+ meow
|
|
37 |
+ purr
|
|
38 |
= purr
|
|
39 |
= meow
|
|
0 |
FalderalSyntaxError: line 12: functionality under test not specified
|
|
0 |
Falderal Test: no functionality
|
|
1 |
-------------------------------
|
|
2 |
|
|
3 |
Since no functionality is specified for these tests,
|
|
4 |
`py-falderal` should exit with an exception.
|
|
5 |
|
|
6 |
-> Functionality "Cat" is implemented by
|
|
7 |
-> shell command "python cat.py"
|
|
8 |
|
|
9 |
Cat cats.
|
|
10 |
|
|
11 |
| meow
|
|
12 |
= meow
|
|
13 |
|
|
14 |
| purr
|
|
15 |
| prrr
|
|
16 |
| prreow
|
|
17 |
= purr
|
|
18 |
= prrr
|
|
19 |
= prreow
|
|
0 |
FAILED :
|
|
1 |
|
|
2 |
Cat dogs, too. (Intentional fail.)
|
|
3 |
|
|
4 |
Location: test-pass-fail.markdown, line 28
|
|
5 |
Function: Cat
|
|
6 |
Impl : shell command "python cat.py"
|
|
7 |
Body : meow
|
|
8 |
Expected: output:
|
|
9 |
woof
|
|
10 |
Actual : output:
|
|
11 |
meow
|
|
12 |
|
|
13 |
FAILED :
|
|
14 |
|
|
15 |
Cat dogs, too. (Intentional fail.)
|
|
16 |
|
|
17 |
Location: test-pass-fail.markdown, line 31
|
|
18 |
Function: Cat
|
|
19 |
Impl : shell command "python cat.py"
|
|
20 |
Body :
|
|
21 |
purr
|
|
22 |
prrr
|
|
23 |
prreow
|
|
24 |
Expected: output:
|
|
25 |
woof
|
|
26 |
woof
|
|
27 |
awoooo
|
|
28 |
Actual : output:
|
|
29 |
purr
|
|
30 |
prrr
|
|
31 |
prreow
|
|
32 |
|
|
33 |
--------------------------------
|
|
34 |
Total test runs: 4, failures: 2
|
|
35 |
--------------------------------
|
|
0 |
Falderal Test: basic pass/fail
|
|
1 |
------------------------------
|
|
2 |
|
|
3 |
This is an example Falderal document which contains some
|
|
4 |
intentionally failing tests. It is intended to test that
|
|
5 |
your Falderal implementation is, itself, not producing
|
|
6 |
incorrect output.
|
|
7 |
|
|
8 |
-> Functionality "Cat" is implemented by
|
|
9 |
-> shell command "python cat.py"
|
|
10 |
|
|
11 |
-> Tests for functionality "Cat"
|
|
12 |
|
|
13 |
Cat cats.
|
|
14 |
|
|
15 |
| meow
|
|
16 |
= meow
|
|
17 |
|
|
18 |
| purr
|
|
19 |
| prrr
|
|
20 |
| prreow
|
|
21 |
= purr
|
|
22 |
= prrr
|
|
23 |
= prreow
|
|
24 |
|
|
25 |
Cat dogs, too. (Intentional fail.)
|
|
26 |
|
|
27 |
| meow
|
|
28 |
= woof
|
|
29 |
|
|
30 |
| purr
|
|
31 |
| prrr
|
|
32 |
| prreow
|
|
33 |
= woof
|
|
34 |
= woof
|
|
35 |
= awoooo
|
0 | |
FAILED :
|
1 | |
|
2 | |
Cat dogs, too. (Intentional fail.)
|
3 | |
|
4 | |
Location: test1.markdown, line 28
|
5 | |
Function: Cat
|
6 | |
Impl : shell command "python cat.py"
|
7 | |
Body : meow
|
8 | |
Expected: output:
|
9 | |
woof
|
10 | |
Actual : output:
|
11 | |
meow
|
12 | |
|
13 | |
FAILED :
|
14 | |
|
15 | |
Cat dogs, too. (Intentional fail.)
|
16 | |
|
17 | |
Location: test1.markdown, line 31
|
18 | |
Function: Cat
|
19 | |
Impl : shell command "python cat.py"
|
20 | |
Body :
|
21 | |
purr
|
22 | |
prrr
|
23 | |
prreow
|
24 | |
Expected: output:
|
25 | |
woof
|
26 | |
woof
|
27 | |
awoooo
|
28 | |
Actual : output:
|
29 | |
purr
|
30 | |
prrr
|
31 | |
prreow
|
32 | |
|
33 | |
--------------------------------
|
34 | |
Total test runs: 4, failures: 2
|
35 | |
--------------------------------
|
0 | |
Falderal Test 1
|
1 | |
---------------
|
2 | |
|
3 | |
This is an example Falderal document which contains some
|
4 | |
intentionally failing tests. It is intended to test that
|
5 | |
your Falderal implementation is, itself, not producing
|
6 | |
incorrect output.
|
7 | |
|
8 | |
-> Functionality "Cat" is implemented by
|
9 | |
-> shell command "python cat.py"
|
10 | |
|
11 | |
-> Tests for functionality "Cat"
|
12 | |
|
13 | |
Cat cats.
|
14 | |
|
15 | |
| meow
|
16 | |
= meow
|
17 | |
|
18 | |
| purr
|
19 | |
| prrr
|
20 | |
| prreow
|
21 | |
= purr
|
22 | |
= prrr
|
23 | |
= prreow
|
24 | |
|
25 | |
Cat dogs, too. (Intentional fail.)
|
26 | |
|
27 | |
| meow
|
28 | |
= woof
|
29 | |
|
30 | |
| purr
|
31 | |
| prrr
|
32 | |
| prreow
|
33 | |
= woof
|
34 | |
= woof
|
35 | |
= awoooo
|
0 | |
--------------------------------
|
1 | |
Total test runs: 0, failures: 0
|
2 | |
--------------------------------
|
0 | |
Falderal Test 10
|
1 | |
----------------
|
2 | |
|
3 | |
Since these blocks are not indented correctly, `py-falderal` should not
|
4 | |
load tests from them. (Ideally it should produce warnings though.)
|
5 | |
|
6 | |
-> Functionality "Cat" is implemented by
|
7 | |
-> shell command "python cat.py"
|
8 | |
|
9 | |
Cat cats.
|
10 | |
|
11 | |
| meow
|
12 | |
= meow
|
13 | |
|
14 | |
| purr
|
15 | |
| prrr
|
16 | |
| prreow
|
17 | |
= purr
|
18 | |
= prrr
|
19 | |
= prreow
|
0 | |
--------------------------------
|
1 | |
Total test runs: 5, failures: 0
|
2 | |
--------------------------------
|
0 | |
Falderal Test 11
|
1 | |
----------------
|
2 | |
|
3 | |
Test tests that have test input sections.
|
4 | |
|
5 | |
-> Functionality "Silly Interpreter" is implemented by
|
6 | |
-> shell command "python silly-interpreter.py %(test-body-file)"
|
7 | |
|
8 | |
-> Tests for functionality "Silly Interpreter"
|
9 | |
|
10 | |
| print x
|
11 | |
=
|
12 | |
|
13 | |
| read x
|
14 | |
| print x
|
15 | |
+ meow
|
16 | |
= meow
|
17 | |
|
18 | |
| read x
|
19 | |
| print x
|
20 | |
+ purr
|
21 | |
= purr
|
22 | |
|
23 | |
| read x
|
24 | |
| print x
|
25 | |
| read y
|
26 | |
| print y
|
27 | |
+ meow
|
28 | |
+ purr
|
29 | |
= meow
|
30 | |
= purr
|
31 | |
|
32 | |
| read x
|
33 | |
| read y
|
34 | |
| print y
|
35 | |
| print x
|
36 | |
+ meow
|
37 | |
+ purr
|
38 | |
= purr
|
39 | |
= meow
|
0 | |
FalderalSyntaxError: line 12: functionality under test not specified
|
0 | |
Falderal Test 2
|
1 | |
---------------
|
2 | |
|
3 | |
Since no functionality is specified for these tests,
|
4 | |
`py-falderal` should exit with an exception.
|
5 | |
|
6 | |
-> Functionality "Cat" is implemented by
|
7 | |
-> shell command "python cat.py"
|
8 | |
|
9 | |
Cat cats.
|
10 | |
|
11 | |
| meow
|
12 | |
= meow
|
13 | |
|
14 | |
| purr
|
15 | |
| prrr
|
16 | |
| prreow
|
17 | |
= purr
|
18 | |
= prrr
|
19 | |
= prreow
|
0 | |
FalderalSyntaxError: line 13: test block must consist of test body and/or test input, then expectation, in that order
|
0 | |
Falderal Test 3
|
1 | |
---------------
|
2 | |
|
3 | |
A Falderal document which is ill-formed.
|
4 | |
|
5 | |
-> Functionality "Cat" is implemented by
|
6 | |
-> shell command "python cat.py"
|
7 | |
|
8 | |
-> Tests for functionality "Cat"
|
9 | |
|
10 | |
Cat cats.
|
11 | |
|
12 | |
| meow
|
13 | |
|
14 | |
Oops, I didn't include an expectation.
|
0 | |
FalderalSyntaxError: line 13: functionality under test not specified
|
|
0 |
FalderalSyntaxError: line 10: functionality under test not specified
|