summaryrefslogtreecommitdiff
path: root/tests/it_text.t
diff options
context:
space:
mode:
authorUrban Müller2011-09-14 13:25:45 +0000
committerUrban Müller2011-09-14 13:25:45 +0000
commiteeb26db00c41f8aae3c96404a898cd2ae4a317ee (patch)
treea780a5dabb491040a3fa925b67262d067f21f4d4 /tests/it_text.t
parente004b6c4f1267f80f1d920fe937eba8a50fda303 (diff)
downloaditools-eeb26db00c41f8aae3c96404a898cd2ae4a317ee.tar.gz
itools-eeb26db00c41f8aae3c96404a898cd2ae4a317ee.tar.bz2
itools-eeb26db00c41f8aae3c96404a898cd2ae4a317ee.zip
fix endless loop, improve performance
Diffstat (limited to 'tests/it_text.t')
-rwxr-xr-xtests/it_text.t18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/it_text.t b/tests/it_text.t
new file mode 100755
index 0000000..bc4d5c0
--- /dev/null
+++ b/tests/it_text.t
@@ -0,0 +1,18 @@
+#!/www/server/bin/php
+<?php
+
+$obj->x = "attr";
+$obj->y->z = "attr";
+
+is(it_text::transmogrify(""), "");
+is(it_text::transmogrify("foo"), "foo");
+is(it_text::transmogrify("{foo}"), "");
+is(it_text::transmogrify("{foo}", array('foo' => 1)), "1");
+is(it_text::transmogrify("{foo}{foo}", array('foo' => 1)), "11");
+is(it_text::transmogrify("{foo}X", array('foo' => 1)), "1X");
+is(it_text::transmogrify("{foo}X{foo}", array('foo' => 1)), "1X1");
+is(it_text::transmogrify("X{foo}", array('foo' => 1)), "X1");
+is(it_text::transmogrify("X{foo}{bar}", array('foo' => 1, 'bar' => 2)), "X12");
+is(it_text::transmogrify("X{foo}", array('foo' => "&")), "X&");
+is(it_text::transmogrify("X{x}", $obj), "Xattr");
+is(it_text::transmogrify("X{y.z}", $obj), "Xattr");