-rw-r--r-- | test/.gitignore | 22 | ||||
-rw-r--r-- | test/Makefile.am | 32 | ||||
-rw-r--r-- | test/r01_closing_at_the_line_start.clichec | 16 | ||||
-rw-r--r-- | test/r01_closing_at_the_line_start.expected | 8 | ||||
-rw-r--r-- | test/r02_anchor_after_literal.clichec | 8 | ||||
-rw-r--r-- | test/r02_anchor_after_literal.expected | 3 | ||||
-rw-r--r-- | test/r03_percent_after_empty.clichec | 8 | ||||
-rw-r--r-- | test/r03_percent_after_empty.expected | 6 | ||||
-rw-r--r-- | test/r04_too_seamless_transitions.clichec | 9 | ||||
-rw-r--r-- | test/r04_too_seamless_transitions.expected | 3 |
10 files changed, 115 insertions, 0 deletions
diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 0000000..54191cb --- a/dev/null +++ b/test/.gitignore | |||
@@ -0,0 +1,22 @@ | |||
1 | /test-suite.log | ||
2 | |||
3 | /r01_closing_at_the_line_start | ||
4 | /r01_closing_at_the_line_start.out | ||
5 | /r01_closing_at_the_line_start.diff | ||
6 | /r01_closing_at_the_line_start.check | ||
7 | /r01_closing_at_the_line_start.log | ||
8 | /r02_anchor_after_literal | ||
9 | /r02_anchor_after_literal.out | ||
10 | /r02_anchor_after_literal.diff | ||
11 | /r02_anchor_after_literal.check | ||
12 | /r02_anchor_after_literal.log | ||
13 | /r03_percent_after_empty | ||
14 | /r03_percent_after_empty.out | ||
15 | /r03_percent_after_empty.diff | ||
16 | /r03_percent_after_empty.check | ||
17 | /r03_percent_after_empty.log | ||
18 | /r04_too_seamless_transitions | ||
19 | /r04_too_seamless_transitions.out | ||
20 | /r04_too_seamless_transitions.diff | ||
21 | /r04_too_seamless_transitions.check | ||
22 | /r04_too_seamless_transitions.log | ||
diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..705278d --- a/dev/null +++ b/test/Makefile.am | |||
@@ -0,0 +1,32 @@ | |||
1 | TESTS=\ | ||
2 | r01_closing_at_the_line_start.clichec \ | ||
3 | r02_anchor_after_literal.clichec \ | ||
4 | r03_percent_after_empty.clichec \ | ||
5 | r04_too_seamless_transitions.clichec | ||
6 | |||
7 | EXTRA_DIST=$(TESTS) | ||
8 | CLEANFILES = $(basename $(TESTS)) \ | ||
9 | $(foreach s,.out .diff,$(addsuffix $s,$(basename $(TESTS)))) | ||
10 | .INTERMEDIATE: $(CLEANFILES) | ||
11 | |||
12 | TEST_EXTENSIONS=.clichec | ||
13 | CLICHEC_LOG_COMPILER=test_clichec() { \ | ||
14 | $(MAKE) "$$(basename $$1 .clichec)"{,.{out,diff,check}} ;\ | ||
15 | }; test_clichec | ||
16 | |||
17 | gitignore: .gitignore | ||
18 | .gitignore: Makefile | ||
19 | for t in ${TESTS} ; do for f in "$${t%.*}"{,.{out,diff,check,log}} ; do \ | ||
20 | grep -q "^/$$f" .gitignore || echo "/$$f" >>.gitignore ;\ | ||
21 | done done | ||
22 | |||
23 | CLICHE=${top_builddir}/src/cliche | ||
24 | SUFFIXES=.clichec .cc .out .diff .check | ||
25 | .clichec.cc: | ||
26 | $(CLICHE) -C -o $@ $< | ||
27 | %.out: % | ||
28 | ${builddir}/$< >$@ | ||
29 | %.diff: ${builddir}/%.out ${srcdir}/%.expected | ||
30 | @-diff -u "$*.expected" "$*.out" >"$@" | ||
31 | %.check: %.diff | ||
32 | @test -s "$<" && { cat "$*.out";cp "$*.out" "$*.unexpected" ; exit 1 ; } || true | ||
diff --git a/test/r01_closing_at_the_line_start.clichec b/test/r01_closing_at_the_line_start.clichec new file mode 100644 index 0000000..11ebd8f --- a/dev/null +++ b/test/r01_closing_at_the_line_start.clichec | |||
@@ -0,0 +1,16 @@ | |||
1 | #include <iostream> | ||
2 | int main() { | ||
3 | const char *t0 = | ||
4 | <%literal> | ||
5 | |||
6 | test-literal | ||
7 | |||
8 | </%literal>; | ||
9 | std::cout << t0; | ||
10 | |||
11 | <%output> | ||
12 | |||
13 | test-output | ||
14 | |||
15 | </%output> | ||
16 | } | ||
diff --git a/test/r01_closing_at_the_line_start.expected b/test/r01_closing_at_the_line_start.expected new file mode 100644 index 0000000..7854811 --- a/dev/null +++ b/test/r01_closing_at_the_line_start.expected | |||
@@ -0,0 +1,8 @@ | |||
1 | |||
2 | |||
3 | test-literal | ||
4 | |||
5 | |||
6 | |||
7 | test-output | ||
8 | |||
diff --git a/test/r02_anchor_after_literal.clichec b/test/r02_anchor_after_literal.clichec new file mode 100644 index 0000000..c2049c0 --- a/dev/null +++ b/test/r02_anchor_after_literal.clichec | |||
@@ -0,0 +1,8 @@ | |||
1 | #include <iostream> | ||
2 | int main() { | ||
3 | const char *l3 = <%literal>line 3</%literal> ":"; int nl3 = __LINE__; | ||
4 | std::cout << l3 << nl3 << std::endl; | ||
5 | {<%output>line 5 (<% __LINE__ %>)</%output>} | ||
6 | int l6 = __LINE__; | ||
7 | std::cout << std::endl << "line 6: " << l6 << std::endl; | ||
8 | }; | ||
diff --git a/test/r02_anchor_after_literal.expected b/test/r02_anchor_after_literal.expected new file mode 100644 index 0000000..b53c949 --- a/dev/null +++ b/test/r02_anchor_after_literal.expected | |||
@@ -0,0 +1,3 @@ | |||
1 | line 3:3 | ||
2 | line 5 (5) | ||
3 | line 6: 6 | ||
diff --git a/test/r03_percent_after_empty.clichec b/test/r03_percent_after_empty.clichec new file mode 100644 index 0000000..62c82eb --- a/dev/null +++ b/test/r03_percent_after_empty.clichec | |||
@@ -0,0 +1,8 @@ | |||
1 | #include <iostream> | ||
2 | int main() {<%output> | ||
3 | Test for broken handling of '^% ' line following the empty line. | ||
4 | Like this: | ||
5 | |||
6 | % std::cout << 1 << std::endl; | ||
7 | |||
8 | </%output>} | ||
diff --git a/test/r03_percent_after_empty.expected b/test/r03_percent_after_empty.expected new file mode 100644 index 0000000..f2ee7b2 --- a/dev/null +++ b/test/r03_percent_after_empty.expected | |||
@@ -0,0 +1,6 @@ | |||
1 | |||
2 | Test for broken handling of '^% ' line following the empty line. | ||
3 | Like this: | ||
4 | |||
5 | 1 | ||
6 | |||
diff --git a/test/r04_too_seamless_transitions.clichec b/test/r04_too_seamless_transitions.clichec new file mode 100644 index 0000000..c313013 --- a/dev/null +++ b/test/r04_too_seamless_transitions.clichec | |||
@@ -0,0 +1,9 @@ | |||
1 | #include <iostream> | ||
2 | int main() { | ||
3 | int a=1,b=2; | ||
4 | <%output> | ||
5 | The transition like this - <% a %><% b %> should not glue 'ab' in the source together. | ||
6 | Really. | ||
7 | </%output> | ||
8 | } | ||
9 | |||
diff --git a/test/r04_too_seamless_transitions.expected b/test/r04_too_seamless_transitions.expected new file mode 100644 index 0000000..2ab4e9f --- a/dev/null +++ b/test/r04_too_seamless_transitions.expected | |||
@@ -0,0 +1,3 @@ | |||
1 | |||
2 | The transition like this - 12 should not glue 'ab' in the source together. | ||
3 | Really. | ||