diff options
author | Nathan Gass | 2012-03-22 18:18:42 +0000 |
---|---|---|
committer | Nathan Gass | 2012-03-22 18:18:42 +0000 |
commit | d59a4921188753dbe4c0161081755a28112c3ef6 (patch) | |
tree | 81496414d988f37f1db9d92c9750d888ffa13746 /devel-utf8/tests/itjs.t | |
parent | ca11771e8fad5fef96615df4c44e04b8fb60ac31 (diff) | |
download | itools-d59a4921188753dbe4c0161081755a28112c3ef6.tar.gz itools-d59a4921188753dbe4c0161081755a28112c3ef6.tar.bz2 itools-d59a4921188753dbe4c0161081755a28112c3ef6.zip |
Branch itools/devel-utf8 created
Diffstat (limited to 'devel-utf8/tests/itjs.t')
-rwxr-xr-x | devel-utf8/tests/itjs.t | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/devel-utf8/tests/itjs.t b/devel-utf8/tests/itjs.t new file mode 100755 index 0000000..f616ced --- /dev/null +++ b/devel-utf8/tests/itjs.t @@ -0,0 +1,50 @@ +#!/www/server/bin/php -qC +<?php + +# Tests for itjs.class, currently only itjs::serialize() + +$_GET['aa'] = 1; + +is( + itjs::serialize(array()), + '[]', + 'empty array' +); + +is( + itjs::serialize(array(0, "0")), + '[0, 0]', + 'number 0' +); + +is( + itjs::serialize(array(null, "", false)), + '["", "", false]', + 'null, empty string, false' +); + +is( + itjs::serialize(array(42, "42", 42.5, "042")), + '[42, 42, "42.5", "042"]', + 'numbers' +); + +is( + itjs::serialize(array('foo' => "bar", "qux", 42 => "quux")), + "{foo:\"bar\",\n'0':\"qux\",\n'42':\"quux\"}", + 'key-value pairs' +); + +is( + itjs::serialize(array('foo' => array('bar' => array("qux", 42)))), + '{foo:{bar:["qux", 42]}}', + 'nested arrays' +); + +is( + itjs::serialize(array('import' => array('function' => array(true, 42)))), + '{\'import\':{\'function\':[true, 42]}}', + 'keywords' +); + +?> |