js/src/tests/Intl/extensions/options-value-emulates-undefined.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/Intl/extensions/options-value-emulates-undefined.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +// |reftest| skip-if(!xulRuntime.shell)
     1.5 +// Any copyright is dedicated to the Public Domain.
     1.6 +// http://creativecommons.org/licenses/publicdomain/
     1.7 +
     1.8 +//-----------------------------------------------------------------------------
     1.9 +var BUGNUMBER = 843004;
    1.10 +var summary =
    1.11 +  "Use of an object that emulates |undefined| as the sole option must " +
    1.12 +  "preclude imputing default values";
    1.13 +
    1.14 +print(BUGNUMBER + ": " + summary);
    1.15 +
    1.16 +if (typeof Intl !== 'object' && typeof quit == 'function') {
    1.17 +  print("Test skipped");
    1.18 +  reportCompare(true, true);
    1.19 +  quit(0);
    1.20 +}
    1.21 +
    1.22 +/**************
    1.23 + * BEGIN TEST *
    1.24 + **************/
    1.25 +
    1.26 +var opt = objectEmulatingUndefined();
    1.27 +opt.toString = function() { return "long"; };
    1.28 +
    1.29 +var str = new Date(2013, 12 - 1, 14).toLocaleString("en-US", { weekday: opt });
    1.30 +
    1.31 +// Because "weekday" was present and not undefined (stringifying to "long"),
    1.32 +// this must be a string like "Saturday" (in this implementation, that is).
    1.33 +assertEq(str, "Saturday");
    1.34 +
    1.35 +if (typeof reportCompare === "function")
    1.36 +  reportCompare(true, true);
    1.37 +
    1.38 +print("Tests complete");

mercurial