summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/run_all.sh6
-rw-r--r--tests/test_array/.gitignore3
-rw-r--r--tests/test_array/code.php13
-rw-r--r--tests/test_array/test.tpl1
-rw-r--r--tests/test_array/want1
-rw-r--r--tests/test_blocks/.gitignore3
-rw-r--r--tests/test_blocks/code.php5
-rw-r--r--tests/test_blocks/master.tpl3
-rw-r--r--tests/test_blocks/test.tpl2
-rw-r--r--tests/test_blocks/want3
-rw-r--r--tests/test_mktag/.gitignore3
-rw-r--r--tests/test_mktag/code.php5
-rw-r--r--tests/test_mktag/test.tpl12
-rw-r--r--tests/test_mktag/want1
-rw-r--r--tests/test_pseudotags/.gitignore3
-rw-r--r--tests/test_pseudotags/code.php5
-rw-r--r--tests/test_pseudotags/test.tpl2
-rw-r--r--tests/test_pseudotags/want2
-rw-r--r--tests/test_short/.gitignore3
-rw-r--r--tests/test_short/code.php5
-rw-r--r--tests/test_short/comment1
-rw-r--r--tests/test_short/test.tpl1
-rw-r--r--tests/test_short/want1
23 files changed, 81 insertions, 3 deletions
diff --git a/tests/run_all.sh b/tests/run_all.sh
index 75909d1..486454b 100755
--- a/tests/run_all.sh
+++ b/tests/run_all.sh
@@ -4,8 +4,8 @@ r=0
for t in test_*; do
cd $t
php ../test.php > have
- echo -n "$t: "
- if cmp want have; then
+ echo -ne "\e[1m$t\e[0m: "
+ if cmp -s want have; then
echo "OK"
rm *.transc.php
else
@@ -18,4 +18,4 @@ for t in test_*; do
cd ..
done
-exit $r \ No newline at end of file
+exit $r
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 @@
+<?php
+
+function test_func($ste) {
+ $ste->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
diff --git a/tests/test_blocks/.gitignore b/tests/test_blocks/.gitignore
new file mode 100644
index 0000000..de2a41b
--- /dev/null
+++ b/tests/test_blocks/.gitignore
@@ -0,0 +1,3 @@
+have
+*.ast
+*.transc.php
diff --git a/tests/test_blocks/code.php b/tests/test_blocks/code.php
new file mode 100644
index 0000000..de8c553
--- /dev/null
+++ b/tests/test_blocks/code.php
@@ -0,0 +1,5 @@
+<?php
+
+function test_func($ste) {
+
+}
diff --git a/tests/test_blocks/master.tpl b/tests/test_blocks/master.tpl
new file mode 100644
index 0000000..a9608bd
--- /dev/null
+++ b/tests/test_blocks/master.tpl
@@ -0,0 +1,3 @@
+Foo
+<ste:block name="blk1">Bar</ste:block>
+<ste:block name="blk2">Baz</ste:block> \ No newline at end of file
diff --git a/tests/test_blocks/test.tpl b/tests/test_blocks/test.tpl
new file mode 100644
index 0000000..44c6891
--- /dev/null
+++ b/tests/test_blocks/test.tpl
@@ -0,0 +1,2 @@
+<ste:load name="master.tpl" />
+<ste:block name="blk1">Replaced</ste:block> \ No newline at end of file
diff --git a/tests/test_blocks/want b/tests/test_blocks/want
new file mode 100644
index 0000000..b9d1515
--- /dev/null
+++ b/tests/test_blocks/want
@@ -0,0 +1,3 @@
+Foo
+Replaced
+Baz \ No newline at end of file
diff --git a/tests/test_mktag/.gitignore b/tests/test_mktag/.gitignore
new file mode 100644
index 0000000..de2a41b
--- /dev/null
+++ b/tests/test_mktag/.gitignore
@@ -0,0 +1,3 @@
+have
+*.ast
+*.transc.php
diff --git a/tests/test_mktag/code.php b/tests/test_mktag/code.php
new file mode 100644
index 0000000..de8c553
--- /dev/null
+++ b/tests/test_mktag/code.php
@@ -0,0 +1,5 @@
+<?php
+
+function test_func($ste) {
+
+}
diff --git a/tests/test_mktag/test.tpl b/tests/test_mktag/test.tpl
new file mode 100644
index 0000000..c381ef4
--- /dev/null
+++ b/tests/test_mktag/test.tpl
@@ -0,0 +1,12 @@
+<ste:mktag name="double"><ste:calc>2 * <ste:tagcontent /></ste:calc></ste:mktag>
+<ste:mktag name="foo" mandatory="a|b">
+ <ste:set var="b">$_tag_parameters[b]</ste:set><ste:comment>Ugly hack, since STE does no scoping...</ste:comment>
+ <ste:for counter="i" start="0" stop="$_tag_parameters[a]">
+ <ste:if>
+ <ste:even>$i</ste:even>
+ <ste:then><ste:double>$i</ste:double></ste:then>
+ <ste:else>$b</ste:else>
+ </ste:if>
+ </ste:for>
+</ste:mktag>
+<ste:foo a="10" b="-" /> \ No newline at end of file
diff --git a/tests/test_mktag/want b/tests/test_mktag/want
new file mode 100644
index 0000000..be0b204
--- /dev/null
+++ b/tests/test_mktag/want
@@ -0,0 +1 @@
+0-4-8-12-16-20 \ No newline at end of file
diff --git a/tests/test_pseudotags/.gitignore b/tests/test_pseudotags/.gitignore
new file mode 100644
index 0000000..de2a41b
--- /dev/null
+++ b/tests/test_pseudotags/.gitignore
@@ -0,0 +1,3 @@
+have
+*.ast
+*.transc.php
diff --git a/tests/test_pseudotags/code.php b/tests/test_pseudotags/code.php
new file mode 100644
index 0000000..de8c553
--- /dev/null
+++ b/tests/test_pseudotags/code.php
@@ -0,0 +1,5 @@
+<?php
+
+function test_func($ste) {
+
+}
diff --git a/tests/test_pseudotags/test.tpl b/tests/test_pseudotags/test.tpl
new file mode 100644
index 0000000..756be8a
--- /dev/null
+++ b/tests/test_pseudotags/test.tpl
@@ -0,0 +1,2 @@
+<ste:comment><ste:comment><ste:foo>Ignore $me<ste:rawtext>Foo</ste:rawtext></ste:comment>
+<ste:rawtext><ste:rawtext>$foo bar <ste:bla a="$b" /></ste:rawtext> \ No newline at end of file
diff --git a/tests/test_pseudotags/want b/tests/test_pseudotags/want
new file mode 100644
index 0000000..4cd4538
--- /dev/null
+++ b/tests/test_pseudotags/want
@@ -0,0 +1,2 @@
+
+<ste:rawtext>$foo bar <ste:bla a="$b" /> \ No newline at end of file
diff --git a/tests/test_short/.gitignore b/tests/test_short/.gitignore
new file mode 100644
index 0000000..de2a41b
--- /dev/null
+++ b/tests/test_short/.gitignore
@@ -0,0 +1,3 @@
+have
+*.ast
+*.transc.php
diff --git a/tests/test_short/code.php b/tests/test_short/code.php
new file mode 100644
index 0000000..de8c553
--- /dev/null
+++ b/tests/test_short/code.php
@@ -0,0 +1,5 @@
+<?php
+
+function test_func($ste) {
+
+}
diff --git a/tests/test_short/comment b/tests/test_short/comment
new file mode 100644
index 0000000..12d7494
--- /dev/null
+++ b/tests/test_short/comment
@@ -0,0 +1 @@
+This currently does not work, since the compiler does not allow tags in tag parameters.
diff --git a/tests/test_short/test.tpl b/tests/test_short/test.tpl
new file mode 100644
index 0000000..42d498b
--- /dev/null
+++ b/tests/test_short/test.tpl
@@ -0,0 +1 @@
+?{~{foo|eq|bar}|FAIL|?{~{~{1|gt|2}|?{y|eq|neq}|~{3|lt|2}}|OK|FAIL}} \ No newline at end of file
diff --git a/tests/test_short/want b/tests/test_short/want
new file mode 100644
index 0000000..a0aba93
--- /dev/null
+++ b/tests/test_short/want
@@ -0,0 +1 @@
+OK \ No newline at end of file