summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2020-04-28 19:29:41 +0200
committerLaria Carolin Chabowski <laria@laria.me>2020-04-28 19:29:41 +0200
commit2d26169b367af60cbc03d417c09918f50aa3b882 (patch)
treeb27542d3ecc6dd02fbb768297b2a097014e35d7f /tests
parentbfd4763b4f831ed9eccbdd4717c98b7d95999d2e (diff)
downloadste-2d26169b367af60cbc03d417c09918f50aa3b882.tar.gz
ste-2d26169b367af60cbc03d417c09918f50aa3b882.tar.bz2
ste-2d26169b367af60cbc03d417c09918f50aa3b882.zip
Fix parser stumbling over "0" in names
PHPs type juggling strikes again :(
Diffstat (limited to 'tests')
-rw-r--r--tests/test_tagname/.gitignore3
-rw-r--r--tests/test_tagname/code.php20
-rw-r--r--tests/test_tagname/test.tpl4
-rw-r--r--tests/test_tagname/want4
4 files changed, 31 insertions, 0 deletions
diff --git a/tests/test_tagname/.gitignore b/tests/test_tagname/.gitignore
new file mode 100644
index 0000000..de2a41b
--- /dev/null
+++ b/tests/test_tagname/.gitignore
@@ -0,0 +1,3 @@
+have
+*.ast
+*.transc.php
diff --git a/tests/test_tagname/code.php b/tests/test_tagname/code.php
new file mode 100644
index 0000000..6001358
--- /dev/null
+++ b/tests/test_tagname/code.php
@@ -0,0 +1,20 @@
+<?php
+
+use kch42\ste\STECore;
+
+function test_func(STECore $ste) {
+ $names = array(
+ "foo",
+ "ab_cd",
+ "foo123baz",
+ "x0123",
+ );
+
+ foreach ($names as $name) {
+ $ste->register_tag(
+ $name,
+ function ($ste, $params, $sub) use ($name) { return $name; }
+ );
+ }
+
+}
diff --git a/tests/test_tagname/test.tpl b/tests/test_tagname/test.tpl
new file mode 100644
index 0000000..30ca889
--- /dev/null
+++ b/tests/test_tagname/test.tpl
@@ -0,0 +1,4 @@
+<ste:foo />
+<ste:ab_cd />
+<ste:foo123baz />
+<ste:x0123 /> \ No newline at end of file
diff --git a/tests/test_tagname/want b/tests/test_tagname/want
new file mode 100644
index 0000000..3233294
--- /dev/null
+++ b/tests/test_tagname/want
@@ -0,0 +1,4 @@
+foo
+ab_cd
+foo123baz
+x0123