diff options
author | Christian Schneider | 2007-02-08 14:51:25 +0000 |
---|---|---|
committer | Christian Schneider | 2007-02-08 14:51:25 +0000 |
commit | 6943a9f3bc10a60fcc01f126dfbd22b24b9c99cb (patch) | |
tree | 7115430bdc88c9a05788b560cf0d58d62807d8f3 /tests/itjs.t | |
parent | e49941bbff3f9d7e87e26265b9971c788b861628 (diff) | |
download | itools-6943a9f3bc10a60fcc01f126dfbd22b24b9c99cb.tar.gz itools-6943a9f3bc10a60fcc01f126dfbd22b24b9c99cb.tar.bz2 itools-6943a9f3bc10a60fcc01f126dfbd22b24b9c99cb.zip |
Moved ITools tests from searchlib to itools/live
Diffstat (limited to 'tests/itjs.t')
-rwxr-xr-x | tests/itjs.t | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/itjs.t b/tests/itjs.t new file mode 100755 index 0000000..8cbf90c --- /dev/null +++ b/tests/itjs.t @@ -0,0 +1,46 @@ +#!/www/server/bin/php -qC +<?php +# +# $Id$ +# +# Tests for itools/itjs.class: itjs::serialize() + +require 'searchlib/search_test.class'; + +is( + itjs::serialize(array()), + '[]', + 'empty array' +); + +is( + itjs::serialize(array(0, "0")), + '[0, 0]', + 'number 0' +); + +is( + itjs::serialize(array(null, "", 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' +); + +?> |