Fix PYSON.Equal with Array
In javascript, Array comparison doesn't work with '=='. It should use the Sao.common.compare. issue5474 review18001002
This commit is contained in:
+5
-1
@@ -249,7 +249,11 @@
|
||||
});
|
||||
|
||||
Sao.PYSON.Equal.eval_ = function(value, context) {
|
||||
return value.s1 == value.s2;
|
||||
if (value.s1 instanceof Array && value.s2 instanceof Array) {
|
||||
return Sao.common.compare(value.s1, value.s2);
|
||||
} else {
|
||||
return value.s1 == value.s2;
|
||||
}
|
||||
};
|
||||
|
||||
Sao.PYSON.Greater = Sao.class_(Sao.PYSON.PYSON, {
|
||||
|
||||
+11
-1
@@ -312,7 +312,17 @@
|
||||
eval_ = new Sao.PYSON.Encoder().encode(
|
||||
new Sao.PYSON.Equal('foo', 'bar'));
|
||||
QUnit.strictEqual(new Sao.PYSON.Decoder().decode(eval_), false,
|
||||
"decode(Equal('test', 'test'))");
|
||||
"decode(Equal('foo', 'bar'))");
|
||||
|
||||
eval_ = new Sao.PYSON.Encoder().encode(
|
||||
new Sao.PYSON.Equal(['test'], ['test']));
|
||||
QUnit.strictEqual(new Sao.PYSON.Decoder().decode(eval_), true,
|
||||
"decode(Equal(['test'], ['test']))");
|
||||
|
||||
eval_ = new Sao.PYSON.Encoder().encode(
|
||||
new Sao.PYSON.Equal(['foo'], ['bar']));
|
||||
QUnit.strictEqual(new Sao.PYSON.Decoder().decode(eval_), false,
|
||||
"decode(Equal(['foo'], ['bar']))");
|
||||
});
|
||||
|
||||
QUnit.test('PYSON Greater', function() {
|
||||
|
||||
Reference in New Issue
Block a user