From 1d00b262ddf0d6c3207a4b796d48899ed79bffcd Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Fri, 26 Aug 2011 21:22:00 +0000 Subject: initial commit into the public repository Signed-off-by: Michael Krelin --- (limited to 'test') 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 @@ +/test-suite.log + +/r01_closing_at_the_line_start +/r01_closing_at_the_line_start.out +/r01_closing_at_the_line_start.diff +/r01_closing_at_the_line_start.check +/r01_closing_at_the_line_start.log +/r02_anchor_after_literal +/r02_anchor_after_literal.out +/r02_anchor_after_literal.diff +/r02_anchor_after_literal.check +/r02_anchor_after_literal.log +/r03_percent_after_empty +/r03_percent_after_empty.out +/r03_percent_after_empty.diff +/r03_percent_after_empty.check +/r03_percent_after_empty.log +/r04_too_seamless_transitions +/r04_too_seamless_transitions.out +/r04_too_seamless_transitions.diff +/r04_too_seamless_transitions.check +/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 @@ +TESTS=\ + r01_closing_at_the_line_start.clichec \ + r02_anchor_after_literal.clichec \ + r03_percent_after_empty.clichec \ + r04_too_seamless_transitions.clichec + +EXTRA_DIST=$(TESTS) +CLEANFILES = $(basename $(TESTS)) \ + $(foreach s,.out .diff,$(addsuffix $s,$(basename $(TESTS)))) +.INTERMEDIATE: $(CLEANFILES) + +TEST_EXTENSIONS=.clichec +CLICHEC_LOG_COMPILER=test_clichec() { \ + $(MAKE) "$$(basename $$1 .clichec)"{,.{out,diff,check}} ;\ +}; test_clichec + +gitignore: .gitignore +.gitignore: Makefile + for t in ${TESTS} ; do for f in "$${t%.*}"{,.{out,diff,check,log}} ; do \ + grep -q "^/$$f" .gitignore || echo "/$$f" >>.gitignore ;\ + done done + +CLICHE=${top_builddir}/src/cliche +SUFFIXES=.clichec .cc .out .diff .check +.clichec.cc: + $(CLICHE) -C -o $@ $< +%.out: % + ${builddir}/$< >$@ +%.diff: ${builddir}/%.out ${srcdir}/%.expected + @-diff -u "$*.expected" "$*.out" >"$@" +%.check: %.diff + @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 @@ +#include +int main() { +const char *t0 = +<%literal> + + test-literal + +; +std::cout << t0; + +<%output> + + test-output + + +} 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 @@ + + + test-literal + + + + test-output + 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 @@ +#include +int main() { +const char *l3 = <%literal>line 3 ":"; int nl3 = __LINE__; +std::cout << l3 << nl3 << std::endl; +{<%output>line 5 (<% __LINE__ %>)} +int l6 = __LINE__; +std::cout << std::endl << "line 6: " << l6 << std::endl; +}; 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 @@ +line 3:3 +line 5 (5) +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 @@ +#include +int main() {<%output> +Test for broken handling of '^% ' line following the empty line. +Like this: + +% std::cout << 1 << std::endl; + +} 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 @@ + +Test for broken handling of '^% ' line following the empty line. +Like this: + +1 + 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 @@ +#include +int main() { +int a=1,b=2; +<%output> +The transition like this - <% a %><% b %> should not glue 'ab' in the source together. +Really. + +} + 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 @@ + +The transition like this - 12 should not glue 'ab' in the source together. +Really. -- cgit v0.9.0.2