From d987adefc85095f057c3d6d3eb2fa4c0d487d32b Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Tue, 21 Apr 2020 01:03:53 +0200 Subject: use new array syntax --- test/autoprepend.t | 14 +++--- test/exec.t | 34 +++++++------- test/getopt.t | 12 ++--- test/it.t | 112 +++++++++++++++++++++++----------------------- test/it_cache.t | 22 ++++----- test/it_dbi.t | 128 ++++++++++++++++++++++++++--------------------------- test/it_html.t | 46 +++++++++---------- test/it_mail.t | 4 +- test/it_url.t | 26 +++++------ test/it_url_slow.t | 8 ++-- test/it_xml.t | 12 ++--- test/itjs.t | 14 +++--- 12 files changed, 216 insertions(+), 216 deletions(-) (limited to 'test') diff --git a/test/autoprepend.t b/test/autoprepend.t index bf40605..7cb33e5 100755 --- a/test/autoprepend.t +++ b/test/autoprepend.t @@ -2,10 +2,10 @@ statictext = array( - '_' => array("de" => "Deutsch", "en" => "English"), - 'foo' => array("de" => "bar {v1}", "en" => "qux {v1}"), -); +$GLOBALS['it_text']->statictext = [ + '_' => ["de" => "Deutsch", "en" => "English"], + 'foo' => ["de" => "bar {v1}", "en" => "qux {v1}"], +]; is( T('foo'), @@ -20,19 +20,19 @@ is( ); is( - T('foo', array('v1' => "gna "gna "gna "gna "gna "gna 'gna')), "gna\n", "exec with argument"); +is(it::exec("echo {arg}", ['arg' => 'gna']), "gna\n", "exec with argument"); is(it::exec("echo {0}", 'gna'), "gna\n", "exec with positional argument"); -is(it::shell_command("echo {arg}", array('arg' => 'gna07,-:blah')), "echo gna07,-:blah", "don't quote arguments with only whitelistes characters"); -is(it::shell_command("echo {arg}", array('arg' => '2>&1')), "echo '2>&1'", "quote arguments with dangerous characters"); -is(it::shell_command("echo {arg}", array('arg' => '')), "echo ''", "quote empty arguments"); +is(it::shell_command("echo {arg}", ['arg' => 'gna07,-:blah']), "echo gna07,-:blah", "don't quote arguments with only whitelistes characters"); +is(it::shell_command("echo {arg}", ['arg' => '2>&1']), "echo '2>&1'", "quote arguments with dangerous characters"); +is(it::shell_command("echo {arg}", ['arg' => '']), "echo ''", "quote empty arguments"); is( - it::shell_command("echo {-opts}", array('-opts' => array('--longopt' => true))), + it::shell_command("echo {-opts}", ['-opts' => ['--longopt' => true]]), "echo --longopt", "options argument with long option" ); is( - it::shell_command("echo {-opts}", array('-opts' => array('-onedash' => true))), + it::shell_command("echo {-opts}", ['-opts' => ['-onedash' => true]]), "echo -onedash", "... with long option but only one dash" ); is( - it::shell_command("echo {-opts}", array('-opts' => array('-s' => true))), + it::shell_command("echo {-opts}", ['-opts' => ['-s' => true]]), "echo -s", "... with short option" ); is( - it::shell_command("echo {-opts}", array('-opts' => array('--longopt' => 'val'))), + it::shell_command("echo {-opts}", ['-opts' => ['--longopt' => 'val']]), "echo --longopt val", "... with long option with value" ); is( - it::shell_command("echo {-opts}", array('-opts' => array('-onedash' => 'val'))), + it::shell_command("echo {-opts}", ['-opts' => ['-onedash' => 'val']]), "echo -onedash val", "... with long option but only one dash and with value" ); is( - it::shell_command("echo {-opts}", array('-opts' => array('-s' => 'val'))), + it::shell_command("echo {-opts}", ['-opts' => ['-s' => 'val']]), "echo -s val", "... with short option with value" ); is( - it::shell_command("echo {-opts}", array('-opts' => array('--longopt' => false))), + it::shell_command("echo {-opts}", ['-opts' => ['--longopt' => false]]), "echo ", "... with disabled long option" ); is( - it::shell_command("echo {-opts}", array('-opts' => array('-s' => false))), + it::shell_command("echo {-opts}", ['-opts' => ['-s' => false]]), "echo ", "... with disabled short option" ); is( - it::shell_command("echo {-opts}", array('-opts' => array('longopt' => true))), + it::shell_command("echo {-opts}", ['-opts' => ['longopt' => true]]), "echo --longopt", "... long option without dashes" ); is( - it::shell_command("echo {-opts}", array('-opts' => array('s' => true))), + it::shell_command("echo {-opts}", ['-opts' => ['s' => true]]), "echo -s", "... short option without dashes" ); -foreach (array("", "C", "de_CH", "de_CH.utf8") as $locale) { +foreach (["", "C", "de_CH", "de_CH.utf8"] as $locale) { setlocale(LC_ALL, $locale); $arg = "preüpost"; if (it::match('utf8', $locale)) $arg = utf8_encode($arg); is(it::exec("echo " . $arg), $arg . "\n", "exec with umlaut (locale '$locale')"); - is(it::exec("echo {arg}", array('arg' => $arg)), $arg . "\n", "exec with argument and umlaut (locale '$locale')"); + is(it::exec("echo {arg}", ['arg' => $arg]), $arg . "\n", "exec with argument and umlaut (locale '$locale')"); } is(it::_exec_quotevalue(""), "''", "empty arg needs quotes"); @@ -84,7 +84,7 @@ it::system('touch /tmp/it_system_test'); ok(file_exists('/tmp/it_system_test'), 'shell command gets executed'); @unlink('/tmp/it_system_test'); -it::system('touch {path}', array('path' => '/tmp/it_system_test')); +it::system('touch {path}', ['path' => '/tmp/it_system_test']); ok(file_exists('/tmp/it_system_test'), 'shell command with argument'); @unlink('/tmp/it_system_test'); diff --git a/test/getopt.t b/test/getopt.t index 8b0ff70..cf3d9e8 100755 --- a/test/getopt.t +++ b/test/getopt.t @@ -12,17 +12,17 @@ $GLOBALS['usage'] = "Usage: doesnotexist.php [OPTIONS] function getopt_ok($argv, $exp, $name) { - $_SERVER['argv'] = array_merge(array('doesnotexist.php'), $argv); + $_SERVER['argv'] = array_merge(['doesnotexist.php'], $argv); $got = it::getopt($GLOBALS['usage']); return is($got['argument'], $exp, $name); } -foreach (array("" => "blah gnaber", " (umlaute)" => "pre üäpost") as $variant => $testarg) { - getopt_ok(array('-a', $testarg), $testarg, "Short version" . $variant); - getopt_ok(array('--argument', $testarg), $testarg, "Long version with space" . $variant); - getopt_ok(array("--argument=$testarg"), $testarg, "Long version with equal" . $variant); +foreach (["" => "blah gnaber", " (umlaute)" => "pre üäpost"] as $variant => $testarg) { + getopt_ok(['-a', $testarg], $testarg, "Short version" . $variant); + getopt_ok(['--argument', $testarg], $testarg, "Long version with space" . $variant); + getopt_ok(["--argument=$testarg"], $testarg, "Long version with equal" . $variant); } -$_SERVER['argv'] = array('doesnotexist.php', '-0'); +$_SERVER['argv'] = ['doesnotexist.php', '-0']; $zero_opts = it::getopt($GLOBALS['usage']); ok($zero_opts['zero'], '-0'); diff --git a/test/it.t b/test/it.t index 26d0f95..65adcd6 100755 --- a/test/it.t +++ b/test/it.t @@ -12,7 +12,7 @@ $oldlocale = setlocale(LC_CTYPE, 0); ini_set('default_charset', 'utf-8'); setlocale(LC_CTYPE, 'de_CH'); # required becuase we're checking German umlauts in latin1 mode -function match($regex, $string, $expect, $name, $p = array()) +function match($regex, $string, $expect, $name, $p = []) { $GLOBALS['TEST_MORE_LEVEL'] = 1; $pass = is (it::match($regex, $string, $p), $expect, $name); @@ -38,7 +38,7 @@ match( match( 'aa(bb)aa(cc)aa(dd)qq', 'aabbaaccaaddqq', - array('bb', 'cc', 'dd'), + ['bb', 'cc', 'dd'], 'return array of captures' ); @@ -197,9 +197,9 @@ match( match( '\w+', 'word1 wörd2 word_3', - array('word1', 'wörd2', 'word_3'), + ['word1', 'wörd2', 'word_3'], "test match_all function", - array('all' => true) + ['all' => true] ); match( @@ -224,14 +224,14 @@ match( utf8_decode('ö'), utf8_decode('Ö'), utf8_decode('Ö'), 'match umlaute in de_CH.latin1 case insensitive', - array('utf8' => false) + ['utf8' => false] ); match( utf8_decode('aöBÜ'), utf8_decode('AÖbü'), utf8_decode('AÖbü'), "match umlaute with non-utf-8 override in p", - array('utf8' => false) + ['utf8' => false] ); @@ -239,35 +239,35 @@ match( 'abc', "aBc", null, "set case sensitivity by parameter", - array('casesensitive' => 1) + ['casesensitive' => 1] ); match( '\w+', 'word1 wörd2 word_3', - array('word1', 'wörd2', 'word_3'), + ['word1', 'wörd2', 'word_3'], "test all => 1 without captures", - array('all' => 1) + ['all' => 1] ); match( '\w+\s+(\d+)', 'word1 12 wörd2 3 word_3 4', - array('12', '3', '4'), + ['12', '3', '4'], "test all => 1 with one capture", - array('all' => 1) + ['all' => 1] ); match( '(\w+)\s+(\d+)', 'word1 12 wörd2 3 word_3 4', - array(array('word1', '12'), array('wörd2', '3'), array('word_3', '4')), + [['word1', '12'], ['wörd2', '3'], ['word_3', '4']], "test all => 1 with captures", - array('all' => 1) + ['all' => 1] ); match( '(\w+)\s+(\d+)', 'word1 12 wörd2 3 word_3 4', - array(array('word1', 'wörd2', 'word_3'), array('12', '3', '4')), + [['word1', 'wörd2', 'word_3'], ['12', '3', '4']], "test all => 1,pattern_order => 1", - array('all' => 1, 'pattern_order' => 1) + ['all' => 1, 'pattern_order' => 1] ); ini_set('default_charset', 'iso-8859-1'); @@ -275,7 +275,7 @@ match( 'aöBÜ', "AÖbü", 'AÖbü', "match utf-8 umlaute in case insensitive mode with utf8 override", - array('utf8' => true) + ['utf8' => true] ); ini_set('default_charset', 'utf-8'); @@ -285,30 +285,30 @@ ini_set('default_charset', 'utf-8'); # is( it::replace( - array( + [ 'regex1' => 'repl1', 'regex2' => 'repl2', - 'regex3' => 'repl3'), + 'regex3' => 'repl3'], 'regex2 regex1 regex3'), 'repl2 repl1 repl3', 'test tr regex function' ); -is(it::replace(array('a' => "1", 'b' => "2"), "ab"), "12"); -is(it::replace(array('!' => "x"), "!"), "x"); -is(it::replace(array('\w' => "x"), "oö"), "xx"); -is(it::replace(array('[[:alpha:]]' => "x"), "ö"), "x"); -is(it::replace(array('\w' => "x", '#' => "!"), "#ö"), "!x"); -is(it::replace(array('#' => "!", '\w' => "x"), "#ö"), "!x"); -is(it::replace(array('ö' => "x"), "Ö"), "x"); -is(it::replace(array('a' => "1"), "aaa", array('limit' => 1)), "1aa"); -is(it::replace(array('\s' => "x"), it_html::entity_decode(" ")), "x", "match non-breaking space as white-space character"); -is(it::replace(array('a' => "b", 'b' => "c"), "a"), "c"); - -is(it::grep('ismatch', array('ismatch', 'isnomatch')), array('ismatch'), 'grep with simple regex'); -is(it::grep('!', array('ismatch!', 'isnomatch')), array('ismatch!'), '! in regex'); -is(it::grep('lower|UPPER', array('lower', 'LOWER', 'upper', 'UPPER'), array('casesensitive' => 1)), array(0 => 'lower', 3 => 'UPPER'), 'set casesensitive'); -is(it::grep('match', array('foo' => 'match', 'bar' => 'gna')), array('foo' => 'match'), 'with keys'); +is(it::replace(['a' => "1", 'b' => "2"], "ab"), "12"); +is(it::replace(['!' => "x"], "!"), "x"); +is(it::replace(['\w' => "x"], "oö"), "xx"); +is(it::replace(['[[:alpha:]]' => "x"], "ö"), "x"); +is(it::replace(['\w' => "x", '#' => "!"], "#ö"), "!x"); +is(it::replace(['#' => "!", '\w' => "x"], "#ö"), "!x"); +is(it::replace(['ö' => "x"], "Ö"), "x"); +is(it::replace(['a' => "1"], "aaa", ['limit' => 1]), "1aa"); +is(it::replace(['\s' => "x"], it_html::entity_decode(" ")), "x", "match non-breaking space as white-space character"); +is(it::replace(['a' => "b", 'b' => "c"], "a"), "c"); + +is(it::grep('ismatch', ['ismatch', 'isnomatch']), ['ismatch'], 'grep with simple regex'); +is(it::grep('!', ['ismatch!', 'isnomatch']), ['ismatch!'], '! in regex'); +is(it::grep('lower|UPPER', ['lower', 'LOWER', 'upper', 'UPPER'], ['casesensitive' => 1]), [0 => 'lower', 3 => 'UPPER'], 'set casesensitive'); +is(it::grep('match', ['foo' => 'match', 'bar' => 'gna']), ['foo' => 'match'], 'with keys'); is(it::grep('2', [0 => 1, 1 => 2, 2 => 3], ['invert' => true]), [0 => 1, 2 => 3]); setlocale(LC_CTYPE, $oldlocale); @@ -326,21 +326,21 @@ is(it::cidr_match('192.168.42.42', '192.168.42.64/26'), false, "cidr_match o is(it::cidr_match('192.168.42.42', '192.168.42.32/27'), true, "cidr_match offset"); is(it::cidr_match('2001:918:ff83:101:798e:77c0:b722:fe56', '2001:918:ff83:101::/64'), true, "cidr_match ipv6"); is(it::cidr_match('2001:918:ff83:102:798e:77c0:b722:fe56', '2001:918:ff83:101::/64'), false, "cidr_match ipv6 no match" ); -is(it::cidr_match('10.11.12.13', array('10.0.0.0/8', '192.168.0.0./16')), true, "cidr_match array"); +is(it::cidr_match('10.11.12.13', ['10.0.0.0/8', '192.168.0.0./16']), true, "cidr_match array"); # it::filter_keys tests -$data = array('a' => 1, 'b' => 2, 'c' => 3); -is(it::filter_keys($data, 'a'), array('a' => 1), "select one key"); -is(it::filter_keys($data, array('a', 'b')), array('a' => 1, 'b' => 2), "select two keys with array"); -is(it::filter_keys($data, 'a,b'), array('a' => 1, 'b' => 2), "select two keys with string"); +$data = ['a' => 1, 'b' => 2, 'c' => 3]; +is(it::filter_keys($data, 'a'), ['a' => 1], "select one key"); +is(it::filter_keys($data, ['a', 'b']), ['a' => 1, 'b' => 2], "select two keys with array"); +is(it::filter_keys($data, 'a,b'), ['a' => 1, 'b' => 2], "select two keys with string"); is( array_keys(it::filter_keys($data, 'b,a')), - array('a', 'b'), + ['a', 'b'], "keep order of data array per default"); is( - array_keys(it::filter_keys($data, 'b,a', array('reorder' => true))), - array('b', 'a'), + array_keys(it::filter_keys($data, 'b,a', ['reorder' => true])), + ['b', 'a'], "reorder with given key order"); # it::date tests @@ -409,10 +409,10 @@ is(it::any2utf8(utf8_encode(utf8_encode("Müller"))), "Müller", "it::any2utf8 t is(it::any2utf8(utf8_decode("Müller")), "Müller", "it::any2utf8 incorrectly encoded latin1"); is(it::any2utf8("a💚b"), "a💚b", "it::any2utf8 correctly handles 4-byte utf-8 character GREEN HEART"); -is(it::any2utf8(array("foo", utf8_decode("bär"))), array("foo", "bär"), "any2utf8 on arrays"); -is(it::any2utf8(array("foo", array(utf8_decode("bär")))), array("foo", array("bär")), "any2utf8 on recursive arrays"); -is(it::any2utf8(array(1, true, false, null)), array(1, true, false, null), "any2utf8 should leave types alone"); -is(it::any2utf8(array(utf8_decode('Müller') => utf8_decode('Müller'))), array('Müller' => 'Müller'), "it::any2utf8 latin1 keys"); +is(it::any2utf8(["foo", utf8_decode("bär")]), ["foo", "bär"], "any2utf8 on arrays"); +is(it::any2utf8(["foo", [utf8_decode("bär")]]), ["foo", ["bär"]], "any2utf8 on recursive arrays"); +is(it::any2utf8([1, true, false, null]), [1, true, false, null], "any2utf8 should leave types alone"); +is(it::any2utf8([utf8_decode('Müller') => utf8_decode('Müller')]), ['Müller' => 'Müller'], "it::any2utf8 latin1 keys"); is(it::any2utf8("\xc2\xad"), "", "it::any2utf8 remove soft hyphens"); @@ -426,32 +426,32 @@ foreach ([ 'a' => 'ä', 'e' => 'ë', 'i' => 'ï', 'o' => 'ö', 'u' => 'ü' ] as is(it::any2utf8("\x65\xcc\x81"), "é", "it::any2utf8 convert to normal form C"); -foreach (array($dummy, false, true, null, 1, "a", "Ä", "/", array()) as $var) +foreach ([$dummy, false, true, null, 1, "a", "Ä", "/", []] as $var) is(it::json_decode(it::json_encode($var)), $var); is(it::json_decode('{"foo":"bar"}')->foo, "bar"); is(it::json_decode('{"foo":"bar"}', ['assoc' => true])['foo'], "bar"); -is(it::sort(array("2!","19!","1!")), array("1!", "19!", "2!")); -is(it::sort(array("2!","19!","1!"), "r"), array("2!", "19!", "1!")); -is(it::sort(array("2!","19!","1!"), "rn"), array("19!", "2!", "1!")); +is(it::sort(["2!","19!","1!"]), ["1!", "19!", "2!"]); +is(it::sort(["2!","19!","1!"], "r"), ["2!", "19!", "1!"]); +is(it::sort(["2!","19!","1!"], "rn"), ["19!", "2!", "1!"]); is(it::mod(-9, 4), 3); is(it::mod(-8, 4), 0); is(it::mod(0, 4), 0); is(it::mod(7, 4), 3); -is(it::map('5*$k+$v', array(0 => 1, 1 => 2)), array(1, 7)); -is(it::map(function($k, $v) {return 5*$k+$v;}, array(0 => 1, 1 => 2)), array(1, 7)); -is(it::map('strlen', array("aaa", "aa")), array(3, 2)); -is(it::map('it::ucfirst', array("aaa")), array("Aaa")); +is(it::map('5*$k+$v', [0 => 1, 1 => 2]), [1, 7]); +is(it::map(function($k, $v) {return 5*$k+$v;}, [0 => 1, 1 => 2]), [1, 7]); +is(it::map('strlen', ["aaa", "aa"]), [3, 2]); +is(it::map('it::ucfirst', ["aaa"]), ["Aaa"]); $dom = new DOMDocument; $dom->loadXML('42'); is(it::map('$v->C14N()', $dom->childNodes), [ '42' ], "Traversable: Needs copy, not modifiable in-place"); # Special values which are not callable -is(it::map('null', array("aaa", "aa")), array(null, null)); -is(it::map('1', array("aaa", "aa")), array(1, 1)); -is(it::map(42, array("aaa", "aa")), array(42, 42)); +is(it::map('null', ["aaa", "aa"]), [null, null]); +is(it::map('1', ["aaa", "aa"]), [1, 1]); +is(it::map(42, ["aaa", "aa"]), [42, 42]); # Only map selected keys is(it::map('2*$v', [3, 4, 5], ['keys' => '0,1']), [6, 8, 5]); is(it::map('2*$v', [3, 4, 5], ['keys' => [0,1]]), [6, 8, 5]); diff --git a/test/it_cache.t b/test/it_cache.t index 8f804d4..e2e94bf 100755 --- a/test/it_cache.t +++ b/test/it_cache.t @@ -8,8 +8,8 @@ is(it_cache::get('it_cache_t'), 42, "cache put number"); it_cache::put('it_cache_t', false); is(it_cache::get('it_cache_t'), false, "cache get number"); -it_cache::put('it_cache_t', array(2)); -is(it_cache::get('it_cache_t'), array(2), "cache put/get array"); +it_cache::put('it_cache_t', [2]); +is(it_cache::get('it_cache_t'), [2], "cache put/get array"); # test non-distributed apc cache @@ -21,9 +21,9 @@ it_cache::put('it_cache_t', false); unset($GLOBALS['it_cache_local']); is(it_cache::get('it_cache_t'), false, "local put/get false"); -it_cache::put('it_cache_t', array(2)); +it_cache::put('it_cache_t', [2]); unset($GLOBALS['it_cache_local']); -is(it_cache::get('it_cache_t'), array(2), "local put/get array"); +is(it_cache::get('it_cache_t'), [2], "local put/get array"); is(it_cache::get('it_cache_t'.rand(1, 1000)), null, "local get unknown key"); @@ -31,19 +31,19 @@ is(it_cache::get('it_cache_t'.rand(1, 1000)), null, "local get unknown key"); # test distributed memcache $GLOBALS['debug_aslive'] = 1; -it_cache::put('it_cache_d', 42, array('distributed' => 1)); +it_cache::put('it_cache_d', 42, ['distributed' => 1]); it_cache::put('it_cache_d', 0); unset($GLOBALS['it_cache_local']); -is(intval(it_cache::get('it_cache_d', array('distributed' => 1))), 42, "distributed put/get number"); +is(intval(it_cache::get('it_cache_d', ['distributed' => 1])), 42, "distributed put/get number"); -it_cache::put('it_cache_d', false, array('distributed' => 1)); +it_cache::put('it_cache_d', false, ['distributed' => 1]); it_cache::put('it_cache_d', 1); unset($GLOBALS['it_cache_local']); -is(boolval(it_cache::get('it_cache_d', array('distributed' => 1))), false, "distributed put/get false"); +is(boolval(it_cache::get('it_cache_d', ['distributed' => 1])), false, "distributed put/get false"); -it_cache::put('it_cache_d', array(2), array('distributed' => 1)); +it_cache::put('it_cache_d', [2], ['distributed' => 1]); it_cache::put('it_cache_d', 0); unset($GLOBALS['it_cache_local']); -is(it_cache::get('it_cache_d', array('distributed' => 1)), array(2), "distributed put/get array"); +is(it_cache::get('it_cache_d', ['distributed' => 1]), [2], "distributed put/get array"); -is(it_cache::get('it_cache_d'.rand(1, 1000), array('distributed' => 1)), null, "distributed get unknown key"); +is(it_cache::get('it_cache_d'.rand(1, 1000), ['distributed' => 1]), null, "distributed get unknown key"); diff --git a/test/it_dbi.t b/test/it_dbi.t index 705e814..9f43f6e 100755 --- a/test/it_dbi.t +++ b/test/it_dbi.t @@ -4,7 +4,7 @@ # Tests for it_dbi.class # Initialize DB -$db = array('db' => "lib_search_ch", 'safety' => 0); +$db = ['db' => "lib_search_ch", 'safety' => 0]; $dbi = new it_dbi($db); $dbi->query('create temporary table it_dbi_test ( ID int not null auto_increment, @@ -13,13 +13,13 @@ $dbi->query('create temporary table it_dbi_test ( dyncols JSON, primary key(ID) );'); -it_dbi::createclass(array('table' => "it_dbi_test", 'forcecreate' => true)); +it_dbi::createclass(['table' => "it_dbi_test", 'forcecreate' => true]); $record = new it_dbi_test; -$record->insert(array('x' => 42, 'foo' => null)); -$record->insert(array('foo' => "bar")); -$record->insert(array('x' => 64738, 'foo' => "q'uux")); +$record->insert(['x' => 42, 'foo' => null]); +$record->insert(['foo' => "bar"]); +$record->insert(['x' => 64738, 'foo' => "q'uux"]); is( $record->ID, @@ -29,8 +29,8 @@ is( $record->read(1); is( - array($record->_key, $record->x, $record->foo), - array(1, 42, null), + [$record->_key, $record->x, $record->foo], + [1, 42, null], "read" ); @@ -41,7 +41,7 @@ is( ); is( - $record->select(array('foo <>' => ""), "LIMIT 1"), + $record->select(['foo <>' => ""], "LIMIT 1"), 1, "select with multiple parameters (LIMIT part)" ); @@ -51,32 +51,32 @@ is( "select with multiple parameters (foo part)" ); is( - $record->select(array('ID IN' => array(2,3))), + $record->select(['ID IN' => [2,3]]), 2, "select with IN" ); is( - $record->select(array('ID NI' => array(2,3))), + $record->select(['ID NI' => [2,3]]), 2, "select with NI" ); is( - $record->select(array('ID NOT IN' => array(2,3))), + $record->select(['ID NOT IN' => [2,3]]), 1, "select with NOT IN" ); is( - $record->select(array('ID IN' => array())), + $record->select(['ID IN' => []]), 0, "select with empty IN" ); is( - $record->select(array('ID NOT IN' => array())), + $record->select(['ID NOT IN' => []]), 3, "select with empty NOT IN" ); is( - $record->select(array('ID' => array(2,3))), + $record->select(['ID' => [2,3]]), 2, "select with implicit IN" ); @@ -95,14 +95,14 @@ is( "constructor of created class with id parameter" ); -$record = new it_dbi_test(array('x >' => 0), "ORDER BY x DESC"); +$record = new it_dbi_test(['x >' => 0], "ORDER BY x DESC"); is( $record->x, 64738, "constructor of created class with multiple select parameters" ); -$record = new it_dbi_test(array('foo' => 'bar')); +$record = new it_dbi_test(['foo' => 'bar']); is( $record->ID, 2, @@ -116,96 +116,96 @@ is( "constructor without parameters" ); -$record = new it_dbi_test(array('x >' => 0), "ORDER BY x DESC"); +$record = new it_dbi_test(['x >' => 0], "ORDER BY x DESC"); is( $record->x, 64738, "constructor with multiple select parameters" ); -$record->select(array('x' => 64738)); +$record->select(['x' => 64738]); is( - array($record->_key, $record->x, $record->foo), - array(3, 64738, "q'uux"), + [$record->_key, $record->x, $record->foo], + [3, 64738, "q'uux"], "select" ); -$record->update(array('x' => 17)); +$record->update(['x' => 17]); is( - array($record->_key, $record->x, $record->foo), - array(3, 17, "q'uux"), + [$record->_key, $record->x, $record->foo], + [3, 17, "q'uux"], "update" ); is( - $record->update(array('x' => 18), array('x' => 17)), + $record->update(['x' => 18], ['x' => 17]), 1, "return affected rows" ); is( - $record->update(array('x' => 18), array('x' => 17)), + $record->update(['x' => 18], ['x' => 17]), 0, "return zero affected rows" ); -$record->update(array('-x' => 'POW(2,2) * 10')); +$record->update(['-x' => 'POW(2,2) * 10']); is( - array($record->_key, $record->x, $record->foo), - array(3, 40, "q'uux"), + [$record->_key, $record->x, $record->foo], + [3, 40, "q'uux"], "update with function" ); -$record->update(array('foo' => "00")); +$record->update(['foo' => "00"]); $rand = $record->x; is ( - $record->_set(array('x' => $rand, 'foo' => "0")), + $record->_set(['x' => $rand, 'foo' => "0"]), "SET `foo`='0'", 'update: _set optimization' ); -$record->update(array('foo' => NULL)); +$record->update(['foo' => NULL]); is ( - $record->_set(array('foo' => "")), + $record->_set(['foo' => ""]), "SET `foo`=''", 'update: _set optimization with NULL => ""' ); -$record->update(array('foo' => "bar")); -$record->update(array('foo' => "")); +$record->update(['foo' => "bar"]); +$record->update(['foo' => ""]); is ( - $record->_set(array('foo' => NULL)), + $record->_set(['foo' => NULL]), "SET `foo`=NULL", 'update: _set optimization with "" => NULL' ); -$record->update(array('foo' => "bar")); -$record->select(array('foo' => "bar")); +$record->update(['foo' => "bar"]); +$record->select(['foo' => "bar"]); $record->iterate(); is( - array($record->_key, $record->x, $record->foo), - array(2, null, "bar"), + [$record->_key, $record->x, $record->foo], + [2, null, "bar"], "iterate record 2" ); -$record->update(array('foo' => "qux")); +$record->update(['foo' => "qux"]); $record->iterate(); is( - array($record->_key, $record->x, $record->foo), - array(3, $rand, "bar"), + [$record->_key, $record->x, $record->foo], + [3, $rand, "bar"], "iterate record 3" ); -$record->update(array('foo' => "quux")); +$record->update(['foo' => "quux"]); $record->read(2); is( - array($record->_key, isset($record->x), $record->foo), - array(2, false, "qux"), + [$record->_key, isset($record->x), $record->foo], + [2, false, "qux"], "iterate update record 2" ); $record->read(3); is( - array($record->_key, $record->x, $record->foo), - array(3, $rand, "quux"), + [$record->_key, $record->x, $record->foo], + [3, $rand, "quux"], "iterate update record 3" ); @@ -224,7 +224,7 @@ foreach (new it_dbi_test as $id => $record) is($count, 3, "Iterator without select"); $count = 0; -foreach (new it_dbi_test(array('foo <>' => "")) as $id => $record) +foreach (new it_dbi_test(['foo <>' => ""]) as $id => $record) { $count++; is($record->_key, $id, "Iterator id $id"); @@ -237,7 +237,7 @@ foreach ($record as $dummy_rec) is($count, 2, "Iterator reused"); $GLOBALS['debug_sqllog'] = true; -@$record->store(array('ID' => 5, 'x' => 6)); +@$record->store(['ID' => 5, 'x' => 6]); like( $record->_sqllog[1]['query'], "REPLACE", @@ -251,8 +251,8 @@ is( "saving with store" ); -$record->_sqllog = array(); -@$record->store(array('ID' => 5, 'x' => 7)); +$record->_sqllog = []; +@$record->store(['ID' => 5, 'x' => 7]); like( $record->_sqllog[1]['query'], "UPDATE", @@ -266,8 +266,8 @@ is( "updating with store" ); -$record->_sqllog = array(); -@$record->store(array('ID' => 5, 'x' => 7)); +$record->_sqllog = []; +@$record->store(['ID' => 5, 'x' => 7]); is( $record->_sqllog[1]['query'], null, # Only SELECT, no UPDATE @@ -278,7 +278,7 @@ $GLOBALS['debug_sqllog'] = false; # test latin1 (produces warnings on stderr for failing) $record = new it_dbi_test(['charset' => 'latin1']); -$record->select(array('foo' => "\xc3\x28")); +$record->select(['foo' => "\xc3\x28"]); # Test field localization feature @@ -289,30 +289,30 @@ $dbi->query('create temporary table it_dbi_testlocalized ( primary key(ID) );'); -$record = new it_dbi($db + array('table' => "it_dbi_testlocalized")); -$record->insert(array('foobar_de' => "deutsch", 'foobar_fr' => "franz")); -$record->insert(array('foobar_de' => "deutsch2", 'foobar_fr' => "franz2")); +$record = new it_dbi($db + ['table' => "it_dbi_testlocalized"]); +$record->insert(['foobar_de' => "deutsch", 'foobar_fr' => "franz"]); +$record->insert(['foobar_de' => "deutsch2", 'foobar_fr' => "franz2"]); T_set_language('de'); -$record->select(array()); +$record->select([]); $record->iterate(); is( - array($record->_key, $record->foobar), - array(1, "deutsch"), + [$record->_key, $record->foobar], + [1, "deutsch"], "localized field foobar_de" ); $record->iterate(); is( - array($record->_key, $record->foobar), - array(2, "deutsch2"), + [$record->_key, $record->foobar], + [2, "deutsch2"], "localized field foobar_de iterate" ); T_set_language('fr'); $record->read(1); is( - array($record->_key, $record->foobar), - array(1, "franz"), + [$record->_key, $record->foobar], + [1, "franz"], "localized field foobar_fr" ); diff --git a/test/it_html.t b/test/it_html.t index f5daebd..a43f674 100755 --- a/test/it_html.t +++ b/test/it_html.t @@ -7,10 +7,10 @@ it::getopt(""); #handle possible --debug parameter # Traditional html5 generation ini_set('default_charset', "utf-8"); -new it_html(array('htmltype' => "html5", 'prettyprint' => false, 'error_on_redefine' => false)); +new it_html(['htmltype' => "html5", 'prettyprint' => false, 'error_on_redefine' => false]); is( - a(array('href' => "&foo", 'true' => true, 'false' => false, 'null' => null, 'empty' => ""), "bar"), + a(['href' => "&foo", 'true' => true, 'false' => false, 'null' => null, 'empty' => ""], "bar"), 'bar', "tag with attributes" ); @@ -34,7 +34,7 @@ is( ); is( - img(array('src' => "foo.png", 'alt' => "ALT")), + img(['src' => "foo.png", 'alt' => "ALT"]), 'ALT', "img tag with attributes" ); @@ -52,50 +52,50 @@ is( ); is( - it::replace(array('\n+\s*' => ""), select(array('name' => "gna", 'multiple' => true), '1:foo,2:bar', '1,2')), + it::replace(['\n+\s*' => ""], select(['name' => "gna", 'multiple' => true], '1:foo,2:bar', '1,2')), '', "select tag with multiselect" ); is( - it::replace(array('\n+\s*' => ""), select(array('name' => "gna"), array("1" => "foo", "2" => 'bar', '1,2' => "qux"), '1,2')), + it::replace(['\n+\s*' => ""], select(['name' => "gna"], ["1" => "foo", "2" => 'bar', '1,2' => "qux"], '1,2')), '', "select tag without multiselect" ); is( - div(array('arg' => "val: \x03, \x0e, \x0f, \x0c, \xc2\x80, \xc2\x9f, \t, \n, \r", "\x02, \x0e, \x0f, \x0c, \xc2\x80, \xc2\x9f, \t, \n, \r")), + div(['arg' => "val: \x03, \x0e, \x0f, \x0c, \xc2\x80, \xc2\x9f, \t, \n, \r", "\x02, \x0e, \x0f, \x0c, \xc2\x80, \xc2\x9f, \t, \n, \r"]), "
\x02, \x0e, \x0f, \x0c, \xc2\x80, \xc2\x9f, \t, \n, \r
\n", "blank unprintable characters and illegal utf8 in attributes but not in normal text" ); is( - div(array("arg\x03\x0e\x0f\xc2\x80\xc2\x9fendarg" => "value", "content")), + div(["arg\x03\x0e\x0f\xc2\x80\xc2\x9fendarg" => "value", "content"]), "
content
\n", "don't blank unprintable characters and illegal utf8 in attribute names" ); is( - div(array('arg' => "abc äüö éá© œàè îôÇ xyz", "abc äüö éá© œàè îôÇ xyz")), + div(['arg' => "abc äüö éá© œàè îôÇ xyz", "abc äüö éá© œàè îôÇ xyz"]), "
abc äüö éá© œàè îôÇ xyz
\n", "leave legal utf8 intact" ); unset($GLOBALS['debug_utf8check']); is( - div(array('arg' => "value \xc2", "content")), + div(['arg' => "value \xc2", "content"]), "
content
\n", "handle single \\xc2 at end of attribute value" ); is( - div(array("arg\x00end" => "value \x00 end", "content \x00 content end")), + div(["arg\x00end" => "value \x00 end", "content \x00 content end"]), "
content \x00 content end
\n", "handle 0-bytes" ); is( - div(array('arg' => "& \" < > \n '", "& \" < > \n '")), + div(['arg' => "& \" < > \n '", "& \" < > \n '"]), "
& \" < > \n '
\n", "use html entities in attributes but not in normal text" ); @@ -107,16 +107,16 @@ is( ); # Test different html types -foreach (array('html5' => "
", 'html' => "
", 'xhtml' => "
", 'xhtml-mobile' => "
") as $type => $value) +foreach (['html5' => "
", 'html' => "
", 'xhtml' => "
", 'xhtml-mobile' => "
"] as $type => $value) { unset($GLOBALS['it_html']); - new it_html(array('htmltype' => $type, 'error_on_redefine' => false)); - is (trim(br(array('flag' => true))), $value, "Check empty tag and attribute for $type"); + new it_html(['htmltype' => $type, 'error_on_redefine' => false]); + is (trim(br(['flag' => true])), $value, "Check empty tag and attribute for $type"); } # XHTML generation unset($GLOBALS['it_html']); -new it_html(array('htmltype' => "xhtml", 'tags' => "script", 'error_on_redefine' => false)); +new it_html(['htmltype' => "xhtml", 'tags' => "script", 'error_on_redefine' => false]); is( script(), @@ -139,7 +139,7 @@ is( # XML generation unset($GLOBALS['it_html']); -new it_html(array('htmltype' => "xml", 'name' => 'it_html', 'tags' => "xmltest", 'error_on_redefine' => false)); +new it_html(['htmltype' => "xml", 'name' => 'it_html', 'tags' => "xmltest", 'error_on_redefine' => false]); is( xmltest(), @@ -154,7 +154,7 @@ is( ); is( - xmltest(array('href' => "&foo", 'true' => true, 'false' => false, 'null' => null, 'empty' => "")), + xmltest(['href' => "&foo", 'true' => true, 'false' => false, 'null' => null, 'empty' => ""]), '' . "\n", "xmltest tag with attributes" ); @@ -175,14 +175,14 @@ is( class myhtml extends it_html { -function __construct($p = array()) +function __construct($p = []) { parent::__construct($p + ['moretags' => 'overriddentag,defaulttag', 'nonewlinetags' => 'a,b,defaulttag,em,img,input,overriddentag,span,div']); } function myimg($args) { - array_unshift($args, array('alt' => "ALT", 'bar' => "BAR")); + array_unshift($args, ['alt' => "ALT", 'bar' => "BAR"]); return parent::img(array_filter(it_parse_args($args))); } @@ -194,7 +194,7 @@ function overriddentag($args) } unset($GLOBALS['it_html']); -new myhtml(array('htmltype' => "html", 'error_on_redefine' => false)); +new myhtml(['htmltype' => "html", 'error_on_redefine' => false]); is( myimg(['src' => "foo.gif", 'alt' => "foo"]), @@ -203,7 +203,7 @@ is( ); is( - div(array('attr' => 'value'), 'content'), + div(['attr' => 'value'], 'content'), '
content
', "different nonewlinetags respected" ); @@ -264,14 +264,14 @@ is(it_html::entity_decode("A"), "A"); # tests for itools extension is(table(null), "
\n", "table() null argument"); -list($data, $attr) = it_parse_args(array(null)); +list($data, $attr) = it_parse_args([null]); ok($data === "", "it_parse_args compatiblity: treat null like empty string"); # # check transliterations in iso-8859-1 # -it_html::configure(array('charset' => "iso-8859-1")); +it_html::configure(['charset' => "iso-8859-1"]); ini_set('default_charset', "iso-8859-1"); is( diff --git a/test/it_mail.t b/test/it_mail.t index 9c882b8..e5e8ab8 100755 --- a/test/it_mail.t +++ b/test/it_mail.t @@ -56,13 +56,13 @@ is( "Don't remove quoting characters from realname when it contains a quotable character" ); -$mail = new it_mail(array( +$mail = new it_mail([ 'From' => 'Someone Ïmportant <ïmportant@search.ch>', 'To' => 'éxample@example.com, example@example.com, Sömeone Ëlse , "Alfred E. Neuman" , "Schmitt, Sören" ', 'Cc' => 'éxample@example.com, example@example.com, Sömeone Ëlse , "Alfred E. Neuman" , "Schmitt, Sören" ', 'Bcc' => 'éxample@example.com, example@example.com, Sömeone Ëlse , "Alfred E. Neuman" , "Schmitt, Sören" ', 'Subject' => "§önÐë®z€ı¢ħèṇ" -)); +]); is( $mail->to[0], diff --git a/test/it_url.t b/test/it_url.t index b265afa..edfbdb2 100755 --- a/test/it_url.t +++ b/test/it_url.t @@ -137,7 +137,7 @@ ok( ); $url = new it_url('http://bogus.url'); -$page = $url->get(array('url' => 'http://www.gna.ch/')); +$page = $url->get(['url' => 'http://www.gna.ch/']); ok( strpos($page, ''), # UTF8SAFE '$url->get(\'url\' => url) with url as named arg' @@ -236,7 +236,7 @@ handle_server( $output = handle_server( ok( - !it_url::get(array('url' => U('http://localhost:8000/redirect_loop', array('num' => 40)), 'it_error' => false)), + !it_url::get(['url' => U('http://localhost:8000/redirect_loop', ['num' => 40]), 'it_error' => false]), 'it_url::get() handles redirect loop' ) ); @@ -249,7 +249,7 @@ if (!ok( $output = handle_server( ok( - !it_url::get(array('url' => 'http://localhost:8000/does_not_exist', 'retries' => 4)), + !it_url::get(['url' => 'http://localhost:8000/does_not_exist', 'retries' => 4]), 'it_url::get() on 404' ) ); @@ -261,7 +261,7 @@ if (!ok( $output = handle_server( ok( - !it_url::get(array('url' => 'http://localhost:8000/repeat?num=0', 'retries' => 4)), + !it_url::get(['url' => 'http://localhost:8000/repeat?num=0', 'retries' => 4]), 'it_url::get() on empty page' ) ); @@ -286,7 +286,7 @@ if (!ok( handle_server( is( - it_url::get(U('http://localhost:8000/get_server_value', array('key' => 'HTTP_HOST'))), + it_url::get(U('http://localhost:8000/get_server_value', ['key' => 'HTTP_HOST'])), 'localhost:8000', 'it_url::get() sets correct Host header' ) @@ -294,7 +294,7 @@ handle_server( handle_server( is( - it_url::get(U('http://localhost:8000/get_server_value', array('key' => 'HTTP_ACCEPT_LANGUAGE'))), + it_url::get(U('http://localhost:8000/get_server_value', ['key' => 'HTTP_ACCEPT_LANGUAGE'])), T_lang(), 'it_url::get() sets correct Accept-Language header' ) @@ -302,14 +302,14 @@ handle_server( handle_server( ok( - it::match('Mozilla', it_url::get(U('http://localhost:8000/get_server_value', array('key' => 'HTTP_USER_AGENT')))), + it::match('Mozilla', it_url::get(U('http://localhost:8000/get_server_value', ['key' => 'HTTP_USER_AGENT']))), 'it_url::get() sets User-Agent containing Mozilla' ) ); handle_server( is( - it_url::get(U('http://user:password@localhost:8000/get_server_value', array('key' => 'PHP_AUTH_USER'))), + it_url::get(U('http://user:password@localhost:8000/get_server_value', ['key' => 'PHP_AUTH_USER'])), 'user', 'it_url::get() basic authentication user' ) @@ -317,17 +317,17 @@ handle_server( handle_server( is( - it_url::get(U('http://user:password@localhost:8000/get_server_value', array('key' => 'PHP_AUTH_PW'))), + it_url::get(U('http://user:password@localhost:8000/get_server_value', ['key' => 'PHP_AUTH_PW'])), 'password', 'it_url::get() basic authentication password' ) ); -$pages = it_url::get_multi(array('urls' => array('a' => 'http://www.gna.ch/', 'b' => 'http://search.ch/'))); +$pages = it_url::get_multi(['urls' => ['a' => 'http://www.gna.ch/', 'b' => 'http://search.ch/']]); ok(strpos($pages['a'], ''), 'it_url::get_multi got first url'); # UTF8SAFE ok(strpos($pages['b'], ''), 'it_url::get_multi got second url'); # UTF8SAFE is(count($pages), 2, 'it_url::get_multi no additional array elements'); -is(it_url::parse("/foo"), array("/foo"), "it_url::parse path only"); -is(it_url::parse("/foo?"), array("/foo"), "it_url::parse empty parameter"); -is(it_url::parse("/foo?bar=baz&qux=quux"), array("/foo", 'bar' => "baz", 'qux' => "quux"), "it_url::parse parameters"); +is(it_url::parse("/foo"), ["/foo"], "it_url::parse path only"); +is(it_url::parse("/foo?"), ["/foo"], "it_url::parse empty parameter"); +is(it_url::parse("/foo?bar=baz&qux=quux"), ["/foo", 'bar' => "baz", 'qux' => "quux"], "it_url::parse parameters"); diff --git a/test/it_url_slow.t b/test/it_url_slow.t index 04377c5..3462ce2 100755 --- a/test/it_url_slow.t +++ b/test/it_url_slow.t @@ -17,7 +17,7 @@ handle_server( $start = microtime(true); $res = ok( - !it_url::get(array('url' => 'http://localhost:8000/long_sleep', 'timeout' => 5, 'retries' => 0, 'it_error' => false)), + !it_url::get(['url' => 'http://localhost:8000/long_sleep', 'timeout' => 5, 'retries' => 0, 'it_error' => false]), 'it_url::get() fails after timeout seconds with no output' ); $res2 = is( @@ -39,7 +39,7 @@ handle_server( $start = microtime(true); $res = ok( - !it_url::get(array('url' => 'http://localhost:8000/slow_response', 'totaltimeout' => 5, 'retries' => 0, 'it_error' => false)), + !it_url::get(['url' => 'http://localhost:8000/slow_response', 'totaltimeout' => 5, 'retries' => 0, 'it_error' => false]), 'it_url::get() fails for response slower than totaltimeout' ); $res2 = is( @@ -53,12 +53,12 @@ if (!$res || !$res2) handle_server( ok( - it_url::get(U('http://localhost:8000/repeat', array('string' => "abc", 'num' => 1024 * 1024))) == str_repeat("abc", 1024 * 1024), + it_url::get(U('http://localhost:8000/repeat', ['string' => "abc", 'num' => 1024 * 1024])) == str_repeat("abc", 1024 * 1024), 'it_url::get() handles large response' ) ); $start = microtime(true); -it_url::get_multi(array('urls' => array('slow' => 'http://localhost:8000/long_sleep', 'fast' => array('url' => 'http://search.ch/', 'handler' => function () {return true;})))); +it_url::get_multi(['urls' => ['slow' => 'http://localhost:8000/long_sleep', 'fast' => ['url' => 'http://search.ch/', 'handler' => function () {return true;}]]]); ok(intval(microtime(true) - $start) < 4, 'get_multi with handler aborts after fast request'); $output = server_output(); diff --git a/test/it_xml.t b/test/it_xml.t index 84f258f..27f910f 100755 --- a/test/it_xml.t +++ b/test/it_xml.t @@ -3,7 +3,7 @@ # Tests for xml.class -function match($xmldata, $expected, $name, $prefix = "", $p = array()) +function match($xmldata, $expected, $name, $prefix = "", $p = []) { $classname = ($prefix ?: "it") . "_xml"; $varname = $prefix . "foo"; @@ -66,7 +66,7 @@ match( utf8_decode('foo Object ( [val] => x ü y ) '), 'Manual encoding override', "", - array('encoding' => "iso-8859-1") + ['encoding' => "iso-8859-1"] ); match( @@ -80,7 +80,7 @@ match( utf8_decode('foo Object ( [val] => & & & ü ) '), 'Predecode illegal entities while keeping properly encoded ones (iso-8859-1)', "", - array('encoding' => "iso-8859-1") + ['encoding' => "iso-8859-1"] ); match( @@ -88,7 +88,7 @@ match( 'foo Object ( [val] => a b ) ', 'Illegal latin 1 character', "", - array('encoding' => "iso-8859-1") + ['encoding' => "iso-8859-1"] ); # Test inheritance @@ -116,8 +116,8 @@ match( 'my' ); -$x = new foo("", array('prefix' => "test")); -$x->set(array('gna' => 42, 'bar' => array('baz' => array("qux", "quux")))); +$x = new foo("", ['prefix' => "test"]); +$x->set(['gna' => 42, 'bar' => ['baz' => ["qux", "quux"]]]); match( $x->to_xml(), 'foo Object ( [gna] => gna Object ( [val] => 42 ) [bar] => bar Object ( [baz] => Array ( [0] => baz Object ( [val] => qux ) [1] => baz Object ( [val] => quux ) ) ) ) ', diff --git a/test/itjs.t b/test/itjs.t index 777b1ec..caea542 100755 --- a/test/itjs.t +++ b/test/itjs.t @@ -14,43 +14,43 @@ is( ); is( - itjs::serialize(array()), + itjs::serialize([]), '[]', 'empty array' ); is( - itjs::serialize(array(0, "0")), + itjs::serialize([0, "0"]), '[0,"0"]', 'number strings stay strings' ); is( - itjs::serialize(array(null, "", false)), + itjs::serialize([null, "", false]), '[null,"",false]', 'null, empty string, false' ); is( - itjs::serialize(array('foo' => "bar", "qux", 42 => "quux")), + itjs::serialize(['foo' => "bar", "qux", 42 => "quux"]), '{"foo":"bar","0":"qux","42":"quux"}', 'key-value pairs' ); is( - itjs::serialize(array('foo' => array('bar' => array("qux", 42)))), + itjs::serialize(['foo' => ['bar' => ["qux", 42]]]), '{"foo":{"bar":["qux",42]}}', 'nested arrays' ); is( - itjs::serialize(array('import' => array('function' => array(true, 42)))), + itjs::serialize(['import' => ['function' => [true, 42]]]), '{"import":{"function":[true,42]}}', 'keywords' ); is( - itjs::serialize(array('foo"foo' => "bar")), + itjs::serialize(['foo"foo' => "bar"]), '{"foo\"foo":"bar"}', "quote ' in keys" ); -- cgit v1.2.3