summaryrefslogtreecommitdiffabout
path: root/test
authorMichael Krelin <hacker@klever.net>2011-08-26 21:22:00 (UTC)
committer Michael Krelin <hacker@klever.net>2011-08-26 21:22:00 (UTC)
commit1d00b262ddf0d6c3207a4b796d48899ed79bffcd (patch) (unidiff)
tree03d745873ba13ffb0e2fe1831ecb41f7c0b05758 /test
downloadcliche-1d00b262ddf0d6c3207a4b796d48899ed79bffcd.zip
cliche-1d00b262ddf0d6c3207a4b796d48899ed79bffcd.tar.gz
cliche-1d00b262ddf0d6c3207a4b796d48899ed79bffcd.tar.bz2
initial commit into the public repository0.0
Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (limited to 'test') (more/less context) (ignore whitespace changes)
-rw-r--r--test/.gitignore22
-rw-r--r--test/Makefile.am32
-rw-r--r--test/r01_closing_at_the_line_start.clichec16
-rw-r--r--test/r01_closing_at_the_line_start.expected8
-rw-r--r--test/r02_anchor_after_literal.clichec8
-rw-r--r--test/r02_anchor_after_literal.expected3
-rw-r--r--test/r03_percent_after_empty.clichec8
-rw-r--r--test/r03_percent_after_empty.expected6
-rw-r--r--test/r04_too_seamless_transitions.clichec9
-rw-r--r--test/r04_too_seamless_transitions.expected3
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 @@
1TESTS=\
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
7EXTRA_DIST=$(TESTS)
8CLEANFILES = $(basename $(TESTS)) \
9 $(foreach s,.out .diff,$(addsuffix $s,$(basename $(TESTS))))
10.INTERMEDIATE: $(CLEANFILES)
11
12TEST_EXTENSIONS=.clichec
13CLICHEC_LOG_COMPILER=test_clichec() { \
14 $(MAKE) "$$(basename $$1 .clichec)"{,.{out,diff,check}} ;\
15}; test_clichec
16
17gitignore: .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
23CLICHE=${top_builddir}/src/cliche
24SUFFIXES=.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>
2int main() {
3const char *t0 =
4<%literal>
5
6 test-literal
7
8</%literal>;
9std::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>
2int main() {
3const char *l3 = <%literal>line 3</%literal> ":"; int nl3 = __LINE__;
4std::cout << l3 << nl3 << std::endl;
5{<%output>line 5 (<% __LINE__ %>)</%output>}
6int l6 = __LINE__;
7std::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 @@
1line 3:3
2line 5 (5)
3line 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>
2int main() {<%output>
3Test for broken handling of '^% ' line following the empty line.
4Like 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
2Test for broken handling of '^% ' line following the empty line.
3Like this:
4
51
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>
2int main() {
3int a=1,b=2;
4<%output>
5The transition like this - <% a %><% b %> should not glue 'ab' in the source together.
6Really.
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
2The transition like this - 12 should not glue 'ab' in the source together.
3Really.