From 7ae08e3c35760fd7c5cb00d9a8a27488090f952d Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Wed, 23 Oct 2013 15:22:12 +0200 Subject: Added some tests. Many of these break. Mostly because the way whitespace/newlines are added (or not added). This is terribly broken ATM... (It was okay with the old parser, I'll try to replicate that behaviour) --- tests/test_array/.gitignore | 3 +++ tests/test_array/code.php | 13 +++++++++++++ tests/test_array/test.tpl | 1 + tests/test_array/want | 1 + 4 files changed, 18 insertions(+) create mode 100644 tests/test_array/.gitignore create mode 100644 tests/test_array/code.php create mode 100644 tests/test_array/test.tpl create mode 100644 tests/test_array/want (limited to 'tests/test_array') diff --git a/tests/test_array/.gitignore b/tests/test_array/.gitignore new file mode 100644 index 0000000..de2a41b --- /dev/null +++ b/tests/test_array/.gitignore @@ -0,0 +1,3 @@ +have +*.ast +*.transc.php diff --git a/tests/test_array/code.php b/tests/test_array/code.php new file mode 100644 index 0000000..58601e2 --- /dev/null +++ b/tests/test_array/code.php @@ -0,0 +1,13 @@ +vars["foo"] = array( + "a" => array( + "blabla" => "OK" + ), + "b" => "bla" + ); + $ste->vars["bar"] = array( + "baz" => "a" + ); +} diff --git a/tests/test_array/test.tpl b/tests/test_array/test.tpl new file mode 100644 index 0000000..050045d --- /dev/null +++ b/tests/test_array/test.tpl @@ -0,0 +1 @@ +${foo[$bar[baz]][${foo[b]}bla]} \ No newline at end of file diff --git a/tests/test_array/want b/tests/test_array/want new file mode 100644 index 0000000..a0aba93 --- /dev/null +++ b/tests/test_array/want @@ -0,0 +1 @@ +OK \ No newline at end of file -- cgit v1.2.3-70-g09d2 From ecb1ed97be62f26e84d860f3b79244237947aab5 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Fri, 25 Oct 2013 00:15:34 +0200 Subject: Made the tests more tolerant for whitespace. --- tests/run_all.sh | 2 +- tests/test_array/want | 2 +- tests/test_blocks/want | 2 +- tests/test_mktag/want | 12 +++++++++++- tests/test_pseudotags/want | 3 +-- tests/test_simple/want | 2 +- 6 files changed, 16 insertions(+), 7 deletions(-) (limited to 'tests/test_array') diff --git a/tests/run_all.sh b/tests/run_all.sh index 486454b..5727afb 100755 --- a/tests/run_all.sh +++ b/tests/run_all.sh @@ -5,7 +5,7 @@ for t in test_*; do cd $t php ../test.php > have echo -ne "\e[1m$t\e[0m: " - if cmp -s want have; then + if sed 's/\s*//' < have | grep -v '^$' | cmp -s want; then echo "OK" rm *.transc.php else diff --git a/tests/test_array/want b/tests/test_array/want index a0aba93..d86bac9 100644 --- a/tests/test_array/want +++ b/tests/test_array/want @@ -1 +1 @@ -OK \ No newline at end of file +OK diff --git a/tests/test_blocks/want b/tests/test_blocks/want index b9d1515..640cfef 100644 --- a/tests/test_blocks/want +++ b/tests/test_blocks/want @@ -1,3 +1,3 @@ Foo Replaced -Baz \ No newline at end of file +Baz diff --git a/tests/test_mktag/want b/tests/test_mktag/want index be0b204..3e2351c 100644 --- a/tests/test_mktag/want +++ b/tests/test_mktag/want @@ -1 +1,11 @@ -0-4-8-12-16-20 \ No newline at end of file +0 +- +4 +- +8 +- +12 +- +16 +- +20 diff --git a/tests/test_pseudotags/want b/tests/test_pseudotags/want index 4cd4538..3aaffdc 100644 --- a/tests/test_pseudotags/want +++ b/tests/test_pseudotags/want @@ -1,2 +1 @@ - -$foo bar \ No newline at end of file +$foo bar diff --git a/tests/test_simple/want b/tests/test_simple/want index c57eff5..980a0d5 100644 --- a/tests/test_simple/want +++ b/tests/test_simple/want @@ -1 +1 @@ -Hello World! \ No newline at end of file +Hello World! -- cgit v1.2.3-70-g09d2