Avoid using Array#sort in test.

There is some problem with the php target. Let's workaround it for now.
This commit is contained in:
Andy Li
2016-10-01 15:14:58 +08:00
parent 6c588733d9
commit 55ed2c0d5c
+6 -5
View File
@@ -124,15 +124,16 @@ class Test extends TestCase {
assertEquals('A', vars.objMap[key]);
}
}
#if (!php || (haxe_ver >= 3.3))
assertScript('
var keys = [];
for (key in stringMap.keys()) keys.push(key);
keys.sort(function(s1, s2) return s1 > s2 ? 1 : (s2 > s1 ? -1 : 0));
keys.join("_");
', 'a_bar_foo', vars);
#end
', {
var keys = [];
for (key in vars.stringMap.keys()) keys.push(key);
keys.join("_");
}, vars);
assertScript('stringMap.remove("foo"); stringMap.exists("foo");', false, vars);
assertScript('stringMap["foo"] = "a"; stringMap["foo"] += "b"', 'ab', vars);
assertEquals('ab', vars.stringMap['foo']);