Verified Commit 573d66cd authored by Vladimir Sedach's avatar Vladimir Sedach
Browse files

Updated some unit tests for new MV implementation

parent 8d384458
...@@ -133,6 +133,7 @@ ...@@ -133,6 +133,7 @@
for (var i4 = 0; i4 < Math.min(arr1.length, init2.length); i4 += 1) { for (var i4 = 0; i4 < Math.min(arr1.length, init2.length); i4 += 1) {
arr1[i4] = init2[i4]; arr1[i4] = init2[i4];
}; };
__PS_MV_REG = [];
return arr1; return arr1;
})();") })();")
...@@ -144,6 +145,7 @@ ...@@ -144,6 +145,7 @@
for (var i4 = 0; i4 < arr1.length; i4 += 1) { for (var i4 = 0; i4 < arr1.length; i4 += 1) {
arr1[i4] = elt3; arr1[i4] = elt3;
}; };
__PS_MV_REG = [];
return arr1; return arr1;
})();") })();")
...@@ -176,6 +178,7 @@ ...@@ -176,6 +178,7 @@
(lambda () (with-slots (a b) (foo) (+ a b))) (lambda () (with-slots (a b) (foo) (+ a b)))
"function () { "function () {
var object1 = foo(); var object1 = foo();
__PS_MV_REG = [];
return object1.a + object1.b; return object1.a + object1.b;
};") };")
...@@ -207,6 +210,7 @@ ...@@ -207,6 +210,7 @@
"(function () { "(function () {
var _js1 = makeAnObject()[foo]; var _js1 = makeAnObject()[foo];
var _js2 = _js1.bar; var _js2 = _js1.bar;
__PS_MV_REG = [];
return _js2.apply(_js1, null); return _js2.apply(_js1, null);
})();") })();")
...@@ -734,6 +738,7 @@ for (var _js1 in obj) { ...@@ -734,6 +738,7 @@ for (var _js1 in obj) {
map1[k] = bar(k); map1[k] = bar(k);
}; };
}; };
__PS_MV_REG = [];
return map1; return map1;
})();") })();")
...@@ -861,6 +866,7 @@ for (var _js1 = 0; _js1 < _js2; _js1 += 1) { ...@@ -861,6 +866,7 @@ for (var _js1 = 0; _js1 < _js2; _js1 += 1) {
var a = b[_js1]; var a = b[_js1];
append3 = append3.concat(a); append3 = append3.concat(a);
}; };
__PS_MV_REG = [];
return append3; return append3;
})();") })();")
...@@ -1128,6 +1134,7 @@ return element.innerHTML = ['<textarea', disabled || !authorized ? [' disabled=\ ...@@ -1128,6 +1134,7 @@ return element.innerHTML = ['<textarea', disabled || !authorized ? [' disabled=\
var _js2 = 1; var _js2 = 1;
var _js3 = 2; var _js3 = 2;
var _js1 = 3; var _js1 = 3;
__PS_MV_REG = [];
return setBaz(_js2, _js3, _js1); return setBaz(_js2, _js3, _js1);
})();") })();")
...@@ -1201,7 +1208,7 @@ __setf_someThing('foo', 1, 2);") ...@@ -1201,7 +1208,7 @@ __setf_someThing('foo', 1, 2);")
(test-ps-js set-timeout (test-ps-js set-timeout
(set-timeout (lambda () (alert "foo")) 10) (set-timeout (lambda () (alert "foo")) 10)
"setTimeout(function () { return alert('foo'); }, 10);") "setTimeout(function () { __PS_MV_REG = []; return alert('foo'); }, 10);")
(test-ps-js operator-precedence (test-ps-js operator-precedence
(* 3 (+ 4 5) 6) (* 3 (+ 4 5) 6)
...@@ -1292,6 +1299,7 @@ __setf_someThing('foo', 1, 2);") ...@@ -1292,6 +1299,7 @@ __setf_someThing('foo', 1, 2);")
(alert (aref bar 1))) (alert (aref bar 1)))
"function foo() { "function foo() {
var bar = Array.prototype.slice.call(arguments, 0); var bar = Array.prototype.slice.call(arguments, 0);
__PS_MV_REG = [];
return alert(bar[1]); return alert(bar[1]);
};") };")
...@@ -1426,6 +1434,7 @@ __setf_someThing('foo', 1, 2);") ...@@ -1426,6 +1434,7 @@ __setf_someThing('foo', 1, 2);")
"function foo() { "function foo() {
if (1 < 2) { if (1 < 2) {
bar('foo'); bar('foo');
__PS_MV_REG = [];
return 4 * 5; return 4 * 5;
}; };
};") };")
...@@ -1454,12 +1463,16 @@ __setf_someThing('foo', 1, 2);") ...@@ -1454,12 +1463,16 @@ __setf_someThing('foo', 1, 2);")
var _cmp3; var _cmp3;
if (1 < 2) { if (1 < 2) {
bar('foo'); bar('foo');
__PS_MV_REG = [];
return 4 * 5; return 4 * 5;
} else if (a === b) { } else if (a === b) {
__PS_MV_REG = [];
return c + d; return c + d;
} else if (_cmp1 = 2, _cmp2 = 3, _cmp3 = 4, 1 < _cmp1 && _cmp1 < _cmp2 && _cmp2 < _cmp3 && _cmp3 < 5) { } else if (_cmp1 = 2, _cmp2 = 3, _cmp3 = 4, 1 < _cmp1 && _cmp1 < _cmp2 && _cmp2 < _cmp3 && _cmp3 < 5) {
__PS_MV_REG = [];
return x; return x;
} else { } else {
__PS_MV_REG = [];
return 'foo'; return 'foo';
}; };
};") };")
...@@ -1747,6 +1760,7 @@ __setf_someThing('foo', 1, 2);") ...@@ -1747,6 +1760,7 @@ __setf_someThing('foo', 1, 2);")
var foo = function (x) { var foo = function (x) {
return x + 1; return x + 1;
}; };
__PS_MV_REG = [];
return foo(1); return foo(1);
})();") })();")
...@@ -1761,6 +1775,7 @@ var foo = function (x) { ...@@ -1761,6 +1775,7 @@ var foo = function (x) {
var bar = function (y) { var bar = function (y) {
return 2 + y; return 2 + y;
}; };
__PS_MV_REG = [];
return bar(foo(1)); return bar(foo(1));
})();") })();")
...@@ -1777,8 +1792,10 @@ var foo1 = function (x) { ...@@ -1777,8 +1792,10 @@ var foo1 = function (x) {
return x + 1; return x + 1;
}; };
var bar = function (y) { var bar = function (y) {
__PS_MV_REG = [];
return 2 + foo(y); return 2 + foo(y);
}; };
__PS_MV_REG = [];
return bar(foo1(1)); return bar(foo1(1));
})();") })();")
...@@ -1834,6 +1851,7 @@ var foo = function (x, y) { ...@@ -1834,6 +1851,7 @@ var foo = function (x, y) {
}; };
return x + y; return x + y;
}; };
__PS_MV_REG = [];
return foo(1); return foo(1);
})();") })();")
...@@ -2072,6 +2090,7 @@ return x + x; ...@@ -2072,6 +2090,7 @@ return x + x;
(1+ a)))) (1+ a))))
"x = (function () { "x = (function () {
var a = foo(); var a = foo();
__PS_MV_REG = [];
return a != null ? a + 1 : null; return a != null ? a + 1 : null;
})();") })();")
...@@ -2177,8 +2196,10 @@ return x + x; ...@@ -2177,8 +2196,10 @@ return x + x;
(baz y))) (baz y)))
"function foo() { "function foo() {
var y = (function () { var y = (function () {
__PS_MV_REG = [];
return bar(this); return bar(this);
}).call(this); }).call(this);
__PS_MV_REG = [];
return baz(y); return baz(y);
};") };")
...@@ -2239,6 +2260,7 @@ var x = function (x) { ...@@ -2239,6 +2260,7 @@ var x = function (x) {
return x + 1; return x + 1;
}; };
var x1 = 2; var x1 = 2;
__PS_MV_REG = [];
return x(x1); return x(x1);
})();") })();")
...@@ -2385,6 +2407,7 @@ var foo = function (x) { ...@@ -2385,6 +2407,7 @@ var foo = function (x) {
var y = 'undefined' === typeof y ? 0 : y; var y = 'undefined' === typeof y ? 0 : y;
return x + y; return x + y;
}; };
__PS_MV_REG = [];
return foo(1, 'y', 2); return foo(1, 'y', 2);
})();") })();")
...@@ -2502,16 +2525,12 @@ try { ...@@ -2502,16 +2525,12 @@ try {
(test-ps-js multiple-value-bind-simple (test-ps-js multiple-value-bind-simple
(multiple-value-bind (a b) (blah) (multiple-value-bind (a b) (blah)
(+ a b)) (+ a b))
"(function () { "__PS_MV_REG = [];
var prevMv1 = 'undefined' === typeof __PS_MV_REG ? (__PS_MV_REG = undefined) : __PS_MV_REG; (function () {
try {
var a = blah(); var a = blah();
var _db2 = blah === __PS_MV_REG['tag'] ? __PS_MV_REG['values'] : []; var b = __PS_MV_REG[0];
var b = _db2[0]; __PS_MV_REG = [];
return a + b; return a + b;
} finally {
__PS_MV_REG = prevMv1;
};
})();") })();")
(test-ps-js values0 (test-ps-js values0
...@@ -2528,8 +2547,9 @@ try { ...@@ -2528,8 +2547,9 @@ try {
(test-ps-js values2 (test-ps-js values2
(lambda () (values x y)) (lambda () (values x y))
"function () { "function () {
__PS_MV_REG = { 'tag' : arguments.callee, 'values' : [y] }; var val1 = x;
return x; __PS_MV_REG = [y];
return val1;
};") };")
(test-ps-js values3 (test-ps-js values3
...@@ -2632,6 +2652,7 @@ if (foowhat(x)) { ...@@ -2632,6 +2652,7 @@ if (foowhat(x)) {
foo(y); foo(y);
}; };
} else { } else {
__PS_MV_REG = [];
return c; return c;
}; };
};") };")
...@@ -2783,6 +2804,7 @@ try { ...@@ -2783,6 +2804,7 @@ try {
(setf (foo x 1 2 3 4) 5)) (setf (foo x 1 2 3 4) 5))
"function __setf_foo(newValue, b) { "function __setf_foo(newValue, b) {
var foo = Array.prototype.slice.call(arguments, 2); var foo = Array.prototype.slice.call(arguments, 2);
__PS_MV_REG = [];
return doSomething(b, foo, newValue); return doSomething(b, foo, newValue);
}; };
__setf_foo(5, x, 1, 2, 3, 4);") __setf_foo(5, x, 1, 2, 3, 4);")
...@@ -2925,6 +2947,7 @@ try { ...@@ -2925,6 +2947,7 @@ try {
FOO = FOO_TMPSTACK1; FOO = FOO_TMPSTACK1;
}; };
var FOO = 456; var FOO = 456;
__PS_MV_REG = [];
return 4 + 5; return 4 + 5;
})();") })();")
...@@ -2941,6 +2964,7 @@ return 4 + 5; ...@@ -2941,6 +2964,7 @@ return 4 + 5;
try { try {
BAR_TMPSTACK2 = BAR; BAR_TMPSTACK2 = BAR;
BAR = FOO + BAR; BAR = FOO + BAR;
__PS_MV_REG = [];
return blah(); return blah();
} finally { } finally {
BAR = BAR_TMPSTACK2; BAR = BAR_TMPSTACK2;
...@@ -3001,6 +3025,7 @@ var testSymbolMacro1_1 = function () { ...@@ -3001,6 +3025,7 @@ var testSymbolMacro1_1 = function () {
return 2; return 2;
}; };
foo(1); foo(1);
__PS_MV_REG = [];
return testSymbolMacro1_1(); return testSymbolMacro1_1();
})(); })();
bar(1);") bar(1);")
...@@ -3133,11 +3158,13 @@ a === b;") ...@@ -3133,11 +3158,13 @@ a === b;")
scope: { scope: {
foo(); foo();
if (bar()) { if (bar()) {
__PS_MV_REG = [];
foobar(); foobar();
break scope; break scope;
}; };
blee(); blee();
}; };
__PS_MV_REG = [];
return 2; return 2;
};") };")
...@@ -3398,6 +3425,7 @@ for (var i = 0; i < 10; i += 1) { ...@@ -3398,6 +3425,7 @@ for (var i = 0; i < 10; i += 1) {
(function () { (function () {
var x = i + 1; var x = i + 1;
return function () { return function () {
__PS_MV_REG = [];
return i + x; return i + x;
}; };
})(); })();
...@@ -3446,6 +3474,7 @@ while (foo()) { ...@@ -3446,6 +3474,7 @@ while (foo()) {
if (a) { if (a) {
var b = bar[0]; var b = bar[0];
var c = bar.length > 1 ? bar.slice(1) : []; var c = bar.length > 1 ? bar.slice(1) : [];
__PS_MV_REG = [];
return [b, c]; return [b, c];
}; };
};") };")
...@@ -3458,10 +3487,12 @@ while (foo()) { ...@@ -3458,10 +3487,12 @@ while (foo()) {
"function bar() { "function bar() {
foo(1); foo(1);
nilBlock: { nilBlock: {
__PS_MV_REG = [];
foo(2); foo(2);
break nilBlock; break nilBlock;
1 + 2; 1 + 2;
}; };
__PS_MV_REG = [];
return 2; return 2;
};") };")
...@@ -3834,6 +3865,7 @@ return function (x) { ...@@ -3834,6 +3865,7 @@ return function (x) {
"function (x) { "function (x) {
var x1 = 1; var x1 = 1;
foo(x1); foo(x1);
__PS_MV_REG = [];
return ++x; return ++x;
};") };")
...@@ -4083,6 +4115,7 @@ for (var i = 0; i < 5; i += 1) { ...@@ -4083,6 +4115,7 @@ for (var i = 0; i < 5; i += 1) {
(acosh (blah 3.14)) (acosh (blah 3.14))
"(function () { "(function () {
var x1 = blah(3.14); var x1 = blah(3.14);
__PS_MV_REG = [];
return 2 * Math.log(Math.sqrt((x1 + 1) / 2) + Math.sqrt((x1 - 1) / 2)); return 2 * Math.log(Math.sqrt((x1 + 1) / 2) + Math.sqrt((x1 - 1) / 2));
})();") })();")
...@@ -4103,6 +4136,7 @@ for (var i = 0; i < 5; i += 1) { ...@@ -4103,6 +4136,7 @@ for (var i = 0; i < 5; i += 1) {
(let* ((a (bar))))) (let* ((a (bar)))))
"function foo() { "function foo() {
var a = bar(); var a = bar();
__PS_MV_REG = [];
return null; return null;
};") };")
...@@ -4157,6 +4191,7 @@ function foo(x) { ...@@ -4157,6 +4191,7 @@ function foo(x) {
(set-state self (create x (+ offset 1)))))) (set-state self (create x (+ offset 1))))))
"function nextPage(self) { "function nextPage(self) {
var object1 = self.state; var object1 = self.state;
__PS_MV_REG = [];
return object1.count && object1.limit * object1.offset < object1.count ? setState(self, { x : object1.offset + 1 }) : null; return object1.count && object1.limit * object1.offset < object1.count ? setState(self, { x : object1.offset + 1 }) : null;
};") };")
...@@ -4205,6 +4240,7 @@ x = 2 + sideEffect() + x + 5;") ...@@ -4205,6 +4240,7 @@ x = 2 + sideEffect() + x + 5;")
"(function () { "(function () {
var x1 = callMeOnce(); var x1 = callMeOnce();
__PS_MV_REG = [];
return (Math.exp(x1) - Math.exp(-x1)) / 2; return (Math.exp(x1) - Math.exp(-x1)) / 2;
})();") })();")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment