js/src/tests/supporting/test262-shell.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/supporting/test262-shell.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,39 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +/*
     1.9 + * The current crop of Test262 test cases that we run are expected to pass
    1.10 + * unless they crash or throw.  (This isn't true for all Test262 test cases --
    1.11 + * for the ones marked @negative the logic is inverted.  We'll have to deal with
    1.12 + * that concern eventually, but for now we're punting so we can run subsets of
    1.13 + * Test262 tests.)
    1.14 + */
    1.15 +testPassesUnlessItThrows();
    1.16 +
    1.17 +/*
    1.18 + * Test262 function $ERROR throws an error with the message provided. Test262
    1.19 + * test cases call it to indicate failure.
    1.20 + */
    1.21 +function $ERROR(msg)
    1.22 +{
    1.23 +  throw new Error("Test262 error: " + msg);
    1.24 +}
    1.25 +
    1.26 +/*
    1.27 + * Test262 function $INCLUDE loads a file with support functions for the tests.
    1.28 + * This function is replaced in browser.js.
    1.29 + */
    1.30 +function $INCLUDE(file)
    1.31 +{
    1.32 +  load("supporting/" + file);
    1.33 +}
    1.34 +
    1.35 +/*
    1.36 + * Test262 function fnGlobalObject returns the global object.
    1.37 + */
    1.38 +var fnGlobalObject = (function()
    1.39 +{
    1.40 +  var global = Function("return this")();
    1.41 +  return function fnGlobalObject() { return global; };
    1.42 +})();

mercurial