| Index: test/promises-aplus/lib/assert.js
|
| diff --git a/test/mjsunit/regress/regress-3183.js b/test/promises-aplus/lib/assert.js
|
| similarity index 51%
|
| copy from test/mjsunit/regress/regress-3183.js
|
| copy to test/promises-aplus/lib/assert.js
|
| index 0c915b0aec6890faba6d70026f1b465fcd9ee36e..0138f36041d52fbfc2ba713c1e8c961dabc3ef88 100644
|
| --- a/test/mjsunit/regress/regress-3183.js
|
| +++ b/test/promises-aplus/lib/assert.js
|
| @@ -25,72 +25,73 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Flags: --allow-natives-syntax
|
| -
|
| -(function DeoptimizeArgCallFunctionGeneric() {
|
| - var a = [];
|
| -
|
| - function f1(method, array, elem, deopt) {
|
| - assertEquals('push', method);
|
| +// Mimics assert module in node.
|
| +
|
| +function compose(message1, message2) {
|
| + return message2 ? message1 + ': ' + message2 : message1
|
| +}
|
| +
|
| +function fail(actual, expected, message, operator) {
|
| + var e = Error(compose('FAIL', message) +
|
| + ': (' + actual + ' ' + operator + ' ' + expected + ') should hold');
|
| + fails.push(e);
|
| + throw e;
|
| +}
|
| +
|
| +function ok(value, message) {
|
| + if (!value) {
|
| + throw Error(compose('FAIL', + message) + ': value = ' + value);
|
| }
|
| +}
|
|
|
| - function f2() { }
|
| -
|
| - function bar(x, deopt, f) {
|
| - f('push', a, [x], deopt + 0);
|
| +function equal(actual, expected, message) {
|
| + if (!(expected == actual)) {
|
| + fail(actual, expected, message, '==');
|
| }
|
| +}
|
|
|
| - function foo() { return bar(arguments[0], arguments[1], arguments[2]); }
|
| - function baz(f, deopt) { return foo("x", deopt, f); }
|
| -
|
| - baz(f1, 0);
|
| - baz(f2, 0);
|
| - %OptimizeFunctionOnNextCall(baz);
|
| - baz(f1, "deopt");
|
| -})();
|
| -
|
| -
|
| -(function DeoptimizeArgGlobalFunctionGeneric() {
|
| - var a = [];
|
| -
|
| - var f1;
|
| -
|
| - f1 = function(method, array, elem, deopt) {
|
| - assertEquals('push', method);
|
| +function notEqual(actual, expected, message) {
|
| + if (!(expected != actual)) {
|
| + fail(actual, expected, message, '!=');
|
| }
|
| +}
|
|
|
| - function bar(x, deopt, f) {
|
| - f1('push', a, [x], deopt + 0);
|
| +function strictEqual(actual, expected, message) {
|
| + if (!(expected === actual)) {
|
| + fail(actual, expected, message, '===');
|
| }
|
| +}
|
|
|
| - function foo() { return bar(arguments[0], arguments[1]); }
|
| - function baz(deopt) { return foo("x", deopt); }
|
| -
|
| - baz(0);
|
| - baz(0);
|
| - %OptimizeFunctionOnNextCall(baz);
|
| - baz("deopt");
|
| -})();
|
| -
|
| -
|
| -(function DeoptimizeArgCallFunctionRuntime() {
|
| - var a = [];
|
| -
|
| - var f1;
|
| -
|
| - f1 = function(method, array, elem, deopt) {
|
| - assertEquals('push', method);
|
| +function notStrictEqual(actual, expected, message) {
|
| + if (!(expected !== actual)) {
|
| + fail(actual, expected, message, '!==');
|
| }
|
| -
|
| - function bar(x, deopt) {
|
| - %_CallFunction(null, 'push', [x][0], ((deopt + 0), 1), f1);
|
| - }
|
| -
|
| - function foo() { return bar(arguments[0], arguments[1]); }
|
| - function baz(deopt) { return foo(0, deopt); }
|
| -
|
| - baz(0);
|
| - baz(0);
|
| - %OptimizeFunctionOnNextCall(baz);
|
| - baz("deopt");
|
| -})();
|
| +}
|
| +
|
| +function assert(value, message) {
|
| + return ok(value, message);
|
| +}
|
| +
|
| +function notImplemented() {
|
| + throw Error('FAIL: This assertion function is not yet implemented.');
|
| +}
|
| +
|
| +function clear() {
|
| + this.fails = [];
|
| +}
|
| +
|
| +assert.fail = fail;
|
| +assert.ok = ok;
|
| +assert.equal = equal;
|
| +assert.notEqual = notEqual;
|
| +assert.deepEqual = notImplemented;
|
| +assert.notDeepEqual = notImplemented;
|
| +assert.strictEqual = strictEqual;
|
| +assert.notStrictEqual = notStrictEqual;
|
| +assert.throws = notImplemented;
|
| +assert.doesNotThrow = notImplemented;
|
| +assert.ifError = notImplemented;
|
| +
|
| +assert.clear = clear;
|
| +
|
| +exports = assert;
|
|
|