js/src/tests/js1_8_5/extensions/clone-simple.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_8_5/extensions/clone-simple.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,33 @@
     1.4 +// |reftest| skip-if(!xulRuntime.shell)
     1.5 +// -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.6 +// Any copyright is dedicated to the Public Domain.
     1.7 +// http://creativecommons.org/licenses/publicdomain/
     1.8 +
     1.9 +function testEq(b) {
    1.10 +    var a = deserialize(serialize(b));
    1.11 +    assertEq(a, b);
    1.12 +}
    1.13 +
    1.14 +testEq(void 0);
    1.15 +testEq(null);
    1.16 +
    1.17 +testEq(true);
    1.18 +testEq(false);
    1.19 +
    1.20 +testEq(0);
    1.21 +testEq(-0);
    1.22 +testEq(1/0);
    1.23 +testEq(-1/0);
    1.24 +testEq(0/0);
    1.25 +testEq(Math.PI);
    1.26 +
    1.27 +testEq("");
    1.28 +testEq("\0");
    1.29 +testEq("a");  // unit string
    1.30 +testEq("ab");  // length-2 string
    1.31 +testEq("abc\0123\r\n");  // nested null character
    1.32 +testEq("\xff\x7f\u7fff\uffff\ufeff\ufffe");  // random unicode stuff
    1.33 +testEq("\ud800 \udbff \udc00 \udfff"); // busted surrogate pairs
    1.34 +testEq(Array(1024).join(Array(1024).join("x")));  // 2MB string
    1.35 +
    1.36 +reportCompare(0, 0, 'ok');

mercurial