Migrate more tests from blink repository.

All these tests had <script> tags with additional JS code. All embedded script code is (automatically) concatenated with existing .js files into one .js test file per test.

R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/21070002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15943 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 1f9dc8b1
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This test how deep we can recurse, and that we get an exception when we do, as opposed to a stack overflow.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
FAIL msg should be RangeError: Maximum call stack size exceeded.. Was RangeError: Maximum call stack size exceeded.
FAIL msg should be RangeError: Maximum call stack size exceeded.. Was RangeError: Maximum call stack size exceeded.
FAIL msg should be RangeError: Maximum call stack size exceeded.. Was RangeError: Maximum call stack size exceeded.
FAIL msg should be RangeError: Maximum call stack size exceeded.. Was RangeError: Maximum call stack size exceeded.
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("This test how deep we can recurse, and that we get an exception when we do, as opposed to a stack overflow.");
function simpleRecursion(depth) {
if (depth)
simpleRecursion(depth - 1);
}
try {
simpleRecursion(17472);
} catch (ex) {
debug("FAIL: " + ex);
}
try {
simpleRecursion(10000000);
} catch (ex) {
var msg = String(eval(ex));
shouldBe("msg", "'RangeError: Maximum call stack size exceeded.'");
}
try {
simpleRecursion(1000000000);
} catch (ex) {
var msg = String(eval(ex));
shouldBe("msg", "'RangeError: Maximum call stack size exceeded.'");
}
var tooFewArgsDepth = 0;
function tooFewArgsRecursion(a) {
if (tooFewArgsDepth) {
tooFewArgsDepth--;
tooFewArgsRecursion();
}
}
try {
tooFewArgsDepth = 10000000;
tooFewArgsRecursion();
} catch (ex) {
var msg = String(eval(ex));
shouldBe("msg", "'RangeError: Maximum call stack size exceeded.'");
}
function tooManyArgsRecursion(depth) {
if (depth)
tooManyArgsRecursion(depth - 1, 1);
}
try {
tooManyArgsRecursion(10000000, 1);
} catch (ex) {
var msg = String(eval(ex));
shouldBe("msg", "'RangeError: Maximum call stack size exceeded.'");
}
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This test checks toString() round-trip decompilation for binary and unary operators.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS decompiledFunction is 'function () { x + + y;}'
PASS decompiledFunction is 'function () { x + - y;}'
PASS decompiledFunction is 'function () { x - + y;}'
PASS decompiledFunction is 'function () { x - - y;}'
PASS decompiledFunction is 'function () { x * + y;}'
PASS decompiledFunction is 'function () { x * - y;}'
PASS decompiledFunction is 'function () { x / + y;}'
PASS decompiledFunction is 'function () { x / - y;}'
PASS decompiledFunction is 'function () { x % + y;}'
PASS decompiledFunction is 'function () { x % - y;}'
PASS decompiledFunction is 'function () { x++ + y;}'
PASS decompiledFunction is 'function () { x++ - y;}'
PASS decompiledFunction is 'function () { x++ * y;}'
PASS decompiledFunction is 'function () { x++ / y;}'
PASS decompiledFunction is 'function () { x-- + y;}'
PASS decompiledFunction is 'function () { x-- - y;}'
PASS decompiledFunction is 'function () { x-- * y;}'
PASS decompiledFunction is 'function () { x-- / y;}'
PASS decompiledFunction is 'function () { x + ++y;}'
PASS decompiledFunction is 'function () { x - ++y;}'
PASS decompiledFunction is 'function () { x * ++y;}'
PASS decompiledFunction is 'function () { x / ++y;}'
PASS decompiledFunction is 'function () { x + --y;}'
PASS decompiledFunction is 'function () { x - --y;}'
PASS decompiledFunction is 'function () { x * --y;}'
PASS decompiledFunction is 'function () { x / --y;}'
PASS decompiledFunction is 'function () { x++ + ++y;}'
PASS decompiledFunction is 'function () { x++ - ++y;}'
PASS decompiledFunction is 'function () { x++ * ++y;}'
PASS decompiledFunction is 'function () { x++ / ++y;}'
PASS decompiledFunction is 'function () { x-- + ++y;}'
PASS decompiledFunction is 'function () { x-- - ++y;}'
PASS decompiledFunction is 'function () { x-- * ++y;}'
PASS decompiledFunction is 'function () { x-- / ++y;}'
PASS decompiledFunction is 'function () { x++ + --y;}'
PASS decompiledFunction is 'function () { x++ - --y;}'
PASS decompiledFunction is 'function () { x++ * --y;}'
PASS decompiledFunction is 'function () { x++ / --y;}'
PASS decompiledFunction is 'function () { x-- + --y;}'
PASS decompiledFunction is 'function () { x-- - --y;}'
PASS decompiledFunction is 'function () { x-- * --y;}'
PASS decompiledFunction is 'function () { x-- / --y;}'
PASS decompiledFunction is 'function () { + + x;}'
PASS decompiledFunction is 'function () { + - x;}'
PASS decompiledFunction is 'function () { - + x;}'
PASS decompiledFunction is 'function () { - - x;}'
PASS decompiledFunction is 'function () { 1;}'
PASS decompiledFunction is 'function () { -1;}'
PASS decompiledFunction is 'function () { - -1;}'
PASS decompiledFunction is 'function () { - - 0;}'
PASS decompiledFunction is 'function () { - - NaN;}'
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("This test checks toString() round-trip decompilation for binary and unary operators.");
var tests = [
"x + + y",
"x + - y",
"x - + y",
"x - - y",
"x * + y",
"x * - y",
"x / + y",
"x / - y",
"x % + y",
"x % - y",
"x++ + y",
"x++ - y",
"x++ * y",
"x++ / y",
"x-- + y",
"x-- - y",
"x-- * y",
"x-- / y",
"x + ++y",
"x - ++y",
"x * ++y",
"x / ++y",
"x + --y",
"x - --y",
"x * --y",
"x / --y",
"x++ + ++y",
"x++ - ++y",
"x++ * ++y",
"x++ / ++y",
"x-- + ++y",
"x-- - ++y",
"x-- * ++y",
"x-- / ++y",
"x++ + --y",
"x++ - --y",
"x++ * --y",
"x++ / --y",
"x-- + --y",
"x-- - --y",
"x-- * --y",
"x-- / --y",
"+ + x",
"+ - x",
"- + x",
"- - x",
"1",
"-1",
"- -1",
"- - 0",
"- - NaN"
];
for (test in tests) {
var decompiledFunction = eval("(function () { " + tests[test] + ";})").toString().replace(/\n/g, "");
shouldBe("decompiledFunction", "'function () { " + tests[test] + ";}'");
}
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Array().length is 0
PASS (new Array()).length is 0
PASS (new Array(3)).length is 3
PASS (new Array(11, 22)).length is 2
PASS (new Array(11, 22))[0] is 11
PASS Array(11, 22)[1] is 22
PASS (new Array(11, 22))[3] is undefined.
PASS String(new Array(11, 22)) is '11,22'
PASS var a = []; a[0] = 33; a[0] is 33
PASS var a = []; a[0] = 33; a.length is 1
PASS var a = [11, 22]; a.length = 1; String(a); is '11'
PASS var a = [11, 22]; a.length = 1; a.length; is 1
PASS caught; is true
PASS ename is 'RangeError'
PASS caught; is true
PASS ename is 'RangeError'
PASS var a = [11, 22]; a.length = 1; a[1]; is undefined.
PASS Array().toString() is ''
PASS Array(3).toString() is ',,'
PASS Array(11, 22).toString() is '11,22'
PASS String(Array(11, 22).concat(33)) is '11,22,33'
PASS String(Array(2).concat(33, 44)) is ',,33,44'
PASS String(Array(2).concat(Array(2))) is ',,,'
PASS String(Array(11,22).concat(Array(33,44))) is '11,22,33,44'
PASS String(Array(1,2).concat(3,Array(4,5))) is '1,2,3,4,5'
PASS var a = new Array(1,2,3); delete a[1]; String(a.concat(4)) is '1,,3,4'
PASS [1,2,3,4].slice(1, 3).toString() is '2,3'
PASS [1,2,3,4].slice(-3, -1).toString() is '2,3'
PASS [1,2].slice(-9, 0).length is 0
PASS [1,2].slice(1).toString() is '2'
PASS [1,2].slice().toString() is '1,2'
PASS (new Array('a')).length is 1
PASS (new Array('a'))[0] is 'a'
PASS (new Array('a'))[1] is undefined.
PASS Array('a').length is 1
PASS Array('a')[0] is 'a'
PASS String(Array()) is ''
PASS String(Array('a','b')) is 'a,b'
PASS [].length is 0
PASS ['a'].length is 1
PASS ['a'][0] is 'a'
PASS ['a',,'c'][2] is 'c'
PASS ['a',undefined,'c'][1] is undefined
PASS ['a',,'c'][1] is undefined
PASS 1 in ['a',,'c'] is false
PASS 1 in ['a',undefined,'c'] is true
PASS 1 in arrayWithDeletion is false
PASS forInSum([]) is ''
PASS forInSum(Array()) is ''
PASS forInSum(Array('a')) is 'a'
PASS forInSum([,undefined,'x','aa']) is 'undefinedxaa'
PASS forInSum(a0) is ''
PASS forInSum(a1) is 'a'
PASS String([].sort()) is ''
PASS String([3,1,'2'].sort()) is '1,2,3'
PASS String([,'x','aa'].sort()) is 'aa,x,'
PASS String([,undefined,'x','aa'].sort()) is 'aa,x,,'
PASS 2 in [,undefined,'x','aa'].sort() is true
PASS 3 in [,undefined,'x','aa'].sort() is false
PASS var a = ['aa', 'b', 'cccc', 'ddd']; String(a.sort(comp)) is 'b,aa,ddd,cccc'
PASS [0, Infinity].sort(function(a, b) { return a - b }).toString() is '0,Infinity'
PASS [].unshift('a') is 1
PASS ['c'].unshift('a', 'b') is 3
PASS var a = []; a.unshift('a'); String(a) is 'a'
PASS var a = ['c']; a.unshift('a', 'b'); String(a) is 'a,b,c'
PASS String(['a', 'b', 'c'].splice(1, 2, 'x', 'y')) is 'b,c'
PASS arr.length is 40
PASS arr[maxint] is "test"
PASS arr.length is 40
PASS arr[maxint] is undefined
PASS arr.length is maxint
PASS arr[maxint-1] is "test2"
PASS arr.length is 40
PASS arr[55.5] is "test"
PASS arr[65.11111111111111111111111111111] is "test"
PASS arr.length is 40
PASS arr[55.5] is undefined
PASS arr[65.11111111111111111111111111111] is undefined
PASS propnames.length is 3
PASS propnames[0] is '0'
PASS propnames[1] is '1'
PASS propnames[2] is '2'
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
// 15.4 Array Objects
// (c) 2001 Harri Porten <porten@kde.org>
shouldBe("Array().length", "0");
shouldBe("(new Array()).length", "0");
shouldBe("(new Array(3)).length", "3");
shouldBe("(new Array(11, 22)).length", "2");
shouldBe("(new Array(11, 22))[0]", "11");
shouldBe("Array(11, 22)[1]", "22");
shouldBeUndefined("(new Array(11, 22))[3]");
shouldBe("String(new Array(11, 22))", "'11,22'");
shouldBe("var a = []; a[0] = 33; a[0]", "33");
shouldBe("var a = []; a[0] = 33; a.length", "1");
shouldBe("var a = [11, 22]; a.length = 1; String(a);", "'11'");
shouldBe("var a = [11, 22]; a.length = 1; a.length;", "1");
// range checks
var caught = false;
var ename = "";
try {
[].length = -1;
} catch (e) {
// expect Range Error
caught = true;
ename = e.name;
}
shouldBeTrue("caught;");
shouldBe("ename", "'RangeError'");
caught = false;
ename = "";
try {
new Array(Infinity);
} catch (e) {
// expect Range Error
caught = true;
ename = e.name;
}
shouldBeTrue("caught;");
shouldBe("ename", "'RangeError'");
shouldBeUndefined("var a = [11, 22]; a.length = 1; a[1];");
shouldBe("Array().toString()", "''");
shouldBe("Array(3).toString()", "',,'");
shouldBe("Array(11, 22).toString()", "'11,22'");
shouldBe("String(Array(11, 22).concat(33))", "'11,22,33'");
shouldBe("String(Array(2).concat(33, 44))", "',,33,44'");
shouldBe("String(Array(2).concat(Array(2)))", "',,,'");
shouldBe("String(Array(11,22).concat(Array(33,44)))", "'11,22,33,44'");
shouldBe("String(Array(1,2).concat(3,Array(4,5)))", "'1,2,3,4,5'");
shouldBe("var a = new Array(1,2,3); delete a[1]; String(a.concat(4))", "'1,,3,4'");
shouldBe("[1,2,3,4].slice(1, 3).toString()", "'2,3'");
shouldBe("[1,2,3,4].slice(-3, -1).toString()", "'2,3'");
shouldBe("[1,2].slice(-9, 0).length", "0");
shouldBe("[1,2].slice(1).toString()", "'2'");
shouldBe("[1,2].slice().toString()", "'1,2'");
// 2nd set.
shouldBe("(new Array('a')).length", "1");
shouldBe("(new Array('a'))[0]", "'a'");
shouldBeUndefined("(new Array('a'))[1]");
shouldBe("Array('a').length", "1");
shouldBe("Array('a')[0]", "'a'");
shouldBe("String(Array())", "''");
shouldBe("String(Array('a','b'))", "'a,b'");
shouldBe("[].length", "0");
shouldBe("['a'].length", "1");
shouldBe("['a'][0]", "'a'");
shouldBe("['a',,'c'][2]", "'c'");
shouldBe("['a',undefined,'c'][1]", "undefined");
shouldBe("['a',,'c'][1]", "undefined");
shouldBe("1 in ['a',,'c']", "false");
shouldBe("1 in ['a',undefined,'c']", "true");
var arrayWithDeletion = ['a','b','c'];
delete arrayWithDeletion[1];
shouldBe("1 in arrayWithDeletion", "false");
function forInSum(_a) {
var s = '';
for (i in _a)
s += _a[i];
return s;
}
shouldBe("forInSum([])", "''");
shouldBe("forInSum(Array())", "''");
shouldBe("forInSum(Array('a'))", "'a'");
shouldBe("forInSum([,undefined,'x','aa'])", "'undefinedxaa'");
var a0 = [];
shouldBe("forInSum(a0)", "''");
var a1 = [ 'a' ];
shouldBe("forInSum(a1)", "'a'");
shouldBe("String([].sort())", "''")
shouldBe("String([3,1,'2'].sort())", "'1,2,3'");
shouldBe("String([,'x','aa'].sort())", "'aa,x,'");
shouldBe("String([,undefined,'x','aa'].sort())", "'aa,x,,'");
shouldBe("2 in [,undefined,'x','aa'].sort()", "true");
shouldBe("3 in [,undefined,'x','aa'].sort()", "false");
// sort by length
function comp(a, b) {
var la = String(a).length;
var lb = String(b).length;
if (la < lb)
return -1;
else if (la > lb)
return 1;
else
return 0;
}
shouldBe("var a = ['aa', 'b', 'cccc', 'ddd']; String(a.sort(comp))", "'b,aa,ddd,cccc'");
// +/-Infinity as function return value
shouldBe("[0, Infinity].sort(function(a, b) { return a - b }).toString()", "'0,Infinity'");
// Array.unshift()
shouldBe("[].unshift('a')", "1");
shouldBe("['c'].unshift('a', 'b')", "3");
shouldBe("var a = []; a.unshift('a'); String(a)", "'a'");
shouldBe("var a = ['c']; a.unshift('a', 'b'); String(a)", "'a,b,c'");
// Array.splice()
shouldBe("String(['a', 'b', 'c'].splice(1, 2, 'x', 'y'))", "'b,c'");
var maxint = Math.pow(2,32)-1;
var arr = new Array();
// 2^32 should not be treated as a valid array index, i.e.
// setting the property on the array should not result in
// the length being modified
arr.length = 40;
arr[maxint] = "test";
shouldBe("arr.length","40");
shouldBe("arr[maxint]","\"test\"");
delete arr[maxint];
shouldBe("arr.length","40");
shouldBe("arr[maxint]","undefined");
arr[maxint-1] = "test2";
shouldBe("arr.length","maxint");
shouldBe("arr[maxint-1]","\"test2\"");
// Floating point numbers also should not be treated as valid array indices.
arr.length = 40;
arr[55.5] = "test"; // does fit in a JSImmediate number
arr[65.11111111111111111111111111111] = "test"; // does not fit in a JSImmediate number
shouldBe("arr.length","40");
shouldBe("arr[55.5]","\"test\"");
shouldBe("arr[65.11111111111111111111111111111]","\"test\"");
delete arr[55.5];
delete arr[65.11111111111111111111111111111];
shouldBe("arr.length","40");
shouldBe("arr[55.5]","undefined");
shouldBe("arr[65.11111111111111111111111111111]","undefined");
arr = new Array('a','b','c');
arr.__proto__ = { 1: 'x' };
var propnames = new Array();
for (i in arr)
propnames.push(i);
propnames.sort();
shouldBe("propnames.length","3");
shouldBe("propnames[0]","'0'");
shouldBe("propnames[1]","'1'");
shouldBe("propnames[2]","'2'");
function testToString() {
// backup
var backupNumberToString = Number.prototype.toString;
var backupNumberToLocaleString = Number.prototype.toLocaleString;
var backupRegExpToString = RegExp.prototype.toString;
var backupRegExpToLocaleString = RegExp.prototype.toLocaleString;
// change functions
Number.prototype.toString = function() { return "toString"; }
Number.prototype.toLocaleString = function() { return "toLocaleString"; }
RegExp.prototype.toString = function() { return "toString2"; }
RegExp.prototype.toLocaleString = function() { return "toLocaleString2"; }
// the tests
shouldBe("[1].toString()", "'1'");
shouldBe("[1].toLocaleString()", "'toLocaleString'");
Number.prototype.toLocaleString = "invalid";
shouldBe("[1].toLocaleString()", "'1'");
shouldBe("[/r/].toString()", "'toString2'");
shouldBe("[/r/].toLocaleString()", "'toLocaleString2'");
RegExp.prototype.toLocaleString = "invalid";
shouldBe("[/r/].toLocaleString()", "'toString2'");
var caught = false;
try {
[{ toString : 0 }].toString();
} catch (e) {
caught = true;
}
shouldBeTrue("caught");
// restore
Number.prototype.toString = backupNumberToString;
Number.prototype.toLocaleString = backupNumberToLocaleString;
RegExp.prototype.toString = backupRegExpToString;
RegExp.prototype.toLocaleString = backupRegExpToLocaleString;
}
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Boolean() is false
PASS Boolean(true) is true
PASS Boolean(false) is false
PASS (new Boolean(true)).valueOf() is true
PASS (new Boolean(false)).valueOf() is false
PASS (new Boolean(Boolean(true))).valueOf() is true
PASS true.valueOf() === true is true
PASS false.toString() === 'false' is true
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
shouldBe("Boolean()", "false");
shouldBe("Boolean(true)", "true");
shouldBe("Boolean(false)", "false");
shouldBe("(new Boolean(true)).valueOf()", "true");
shouldBe("(new Boolean(false)).valueOf()", "false");
shouldBe("(new Boolean(Boolean(true))).valueOf()", "true");
shouldBeTrue("true.valueOf() === true");
shouldBeTrue("false.toString() === 'false'");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Start Of Test
PASS d.setYear(-1), d.getFullYear() is -1
PASS d.setYear(0), d.getFullYear() is 1900
PASS d.setYear(1), d.getFullYear() is 1901
PASS d.setYear(99), d.getFullYear() is 1999
PASS d.setYear(100), d.getFullYear() is 100
PASS d.setYear(2050), d.getFullYear() is 2050
PASS d.setYear(1899), d.getFullYear() is 1899
PASS d.setYear(2000), d.getFullYear() is 2000
PASS d.setYear(2100), d.getFullYear() is 2100
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
debug("Start Of Test");
var d = new Date();
shouldBe("d.setYear(-1), d.getFullYear()", "-1");
shouldBe("d.setYear(0), d.getFullYear()", "1900");
shouldBe("d.setYear(1), d.getFullYear()", "1901");
shouldBe("d.setYear(99), d.getFullYear()", "1999");
shouldBe("d.setYear(100), d.getFullYear()", "100");
shouldBe("d.setYear(2050), d.getFullYear()", "2050");
shouldBe("d.setYear(1899), d.getFullYear()", "1899");
shouldBe("d.setYear(2000), d.getFullYear()", "2000");
shouldBe("d.setYear(2100), d.getFullYear()", "2100");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Error('msg').message is 'msg'
PASS (new Error('msg')).message is 'msg'
PASS (new Error('msg')).name is 'Error'
PASS Object.prototype.toString.apply(Error()) is '[object Error]'
PASS Object.prototype.toString.apply(Error) is '[object Function]'
PASS Object.prototype.toString.apply(EvalError) is '[object Function]'
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
// Error constructor called as a function
shouldBe("Error('msg').message", "'msg'");
// Error Constructor called as part of a new expression
shouldBe("(new Error('msg')).message", "'msg'");
// moved to evil-n.js shouldBeUndefined("(new Error()).message");
shouldBe("(new Error('msg')).name", "'Error'");
shouldBe("Object.prototype.toString.apply(Error())", "'[object Error]'");
shouldBe("Object.prototype.toString.apply(Error)", "'[object Function]'");
shouldBe("Object.prototype.toString.apply(EvalError)", "'[object Function]'");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS h.charCodeAt(1) is 239
PASS u.charCodeAt(1) is 4660
PASS escape(h) is 'a%EFc'
PASS escape(u) is 'a%u1234c'
PASS escape(z) is '%00'
PASS unescape(escape(h)) is h
PASS unescape(escape(u)) is u
PASS unescape(escape(z)) is z
PASS isNaN(NaN) is true
PASS isNaN('NaN') is true
PASS isNaN('1') is false
PASS isFinite(1) is true
PASS isFinite('1') is true
PASS isFinite('a') is false
PASS isNaN(parseInt("Hello", 8)) is true
PASS isNaN(parseInt("FFF", 10)) is true
PASS isNaN(parseInt(".5", 10)) is true
PASS isFinite(Infinity) is false
PASS isFinite('Infinity') is false
PASS isNaN(parseInt()) is true
PASS isNaN(parseInt('')) is true
PASS isNaN(parseInt(' ')) is true
PASS isNaN(parseInt('a')) is true
PASS parseInt(1) is 1
PASS parseInt(1234567890123456) is 1234567890123456
PASS parseInt(1.2) is 1
PASS parseInt(' 2.3') is 2
PASS parseInt('0x10') is 16
PASS parseInt('11', 0) is 11
PASS parseInt('F', 16) is 15
PASS isNaN(parseInt('10', 40)) is true
PASS parseInt('3x') is 3
PASS parseInt('3 x') is 3
PASS isNaN(parseInt('Infinity')) is true
PASS parseInt("15") is 15
PASS parseInt("015") is 15
PASS parseInt("0xf") is 15
PASS parseInt("15", 0) is 15
PASS parseInt("15", 10) is 15
PASS parseInt("F", 16) is 15
PASS parseInt("17", 8) is 15
PASS parseInt("15.99", 10) is 15
PASS parseInt("FXX123", 16) is 15
PASS parseInt("1111", 2) is 15
PASS parseInt("15*3", 10) is 15
PASS parseInt("0x7", 10) is 0
PASS parseInt("1x7", 10) is 1
PASS isNaN(parseFloat()) is true
PASS isNaN(parseFloat('')) is true
PASS isNaN(parseFloat(' ')) is true
PASS isNaN(parseFloat('a')) is true
PASS parseFloat(1) is 1
PASS parseFloat(' 2.3') is 2.3
PASS parseFloat('3.1 x', 3) is 3.1
PASS parseFloat('3.1x', 3) is 3.1
PASS isFinite(parseFloat('Infinity')) is false
PASS delete NaN is false
PASS delete Infinity is false
PASS delete undefined is false
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
var h = "a\xefc";
var u = "a\u1234c";
var z = "\x00";
shouldBe("h.charCodeAt(1)", "239");
shouldBe("u.charCodeAt(1)", "4660");
shouldBe("escape(h)", "'a%EFc'");
shouldBe("escape(u)", "'a%u1234c'");
shouldBe("escape(z)", "'%00'");
shouldBe("unescape(escape(h))", "h");
shouldBe("unescape(escape(u))", "u");
shouldBe("unescape(escape(z))", "z");
shouldBeTrue("isNaN(NaN)");
shouldBeTrue("isNaN('NaN')");
shouldBeFalse("isNaN('1')");
shouldBeTrue("isFinite(1)");
shouldBeTrue("isFinite('1')");
// all should return NaN because 1st char is non-number
shouldBeFalse("isFinite('a')");
shouldBe('isNaN(parseInt("Hello", 8))', "true");
shouldBe('isNaN(parseInt("FFF", 10))', "true");
shouldBe('isNaN(parseInt(".5", 10))', "true");
shouldBeFalse("isFinite(Infinity)");
shouldBeFalse("isFinite('Infinity')");
shouldBeTrue("isNaN(parseInt())");
shouldBeTrue("isNaN(parseInt(''))");
shouldBeTrue("isNaN(parseInt(' '))");
shouldBeTrue("isNaN(parseInt('a'))");
shouldBe("parseInt(1)", "1");
shouldBe("parseInt(1234567890123456)", "1234567890123456");
shouldBe("parseInt(1.2)", "1");
shouldBe("parseInt(' 2.3')", "2");
shouldBe("parseInt('0x10')", "16");
shouldBe("parseInt('11', 0)", "11");
shouldBe("parseInt('F', 16)", "15");
shouldBeTrue("isNaN(parseInt('10', 40))");
shouldBe("parseInt('3x')", "3");
shouldBe("parseInt('3 x')", "3");
shouldBeTrue("isNaN(parseInt('Infinity'))");
// all should return 15
shouldBe('parseInt("15")', "15");
shouldBe('parseInt("015")', "15"); // ES5 prohibits parseInt from handling octal, see annex E.
shouldBe('parseInt("0xf")', "15");
shouldBe('parseInt("15", 0)', "15");
shouldBe('parseInt("15", 10)', "15");
shouldBe('parseInt("F", 16)', "15");
shouldBe('parseInt("17", 8)', "15");
shouldBe('parseInt("15.99", 10)', "15");
shouldBe('parseInt("FXX123", 16)', "15");
shouldBe('parseInt("1111", 2)', "15");
shouldBe('parseInt("15*3", 10)', "15");
// this should be 0
shouldBe('parseInt("0x7", 10)', "0");
shouldBe('parseInt("1x7", 10)', "1");
shouldBeTrue("isNaN(parseFloat())");
shouldBeTrue("isNaN(parseFloat(''))");
shouldBeTrue("isNaN(parseFloat(' '))");
shouldBeTrue("isNaN(parseFloat('a'))");
shouldBe("parseFloat(1)", "1");
shouldBe("parseFloat(' 2.3')", "2.3");
shouldBe("parseFloat('3.1 x', 3)", "3.1");
shouldBe("parseFloat('3.1x', 3)", "3.1");
shouldBeFalse("isFinite(parseFloat('Infinity'))");
shouldBeFalse("delete NaN");
shouldBeFalse("delete Infinity");
shouldBeFalse("delete undefined");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Number() is 0
PASS Number(1) is 1
PASS Number(1.1) is 1.1
PASS Number('1.2') is 1.2
PASS isNaN(Number('a')) is true
PASS (new Number()).valueOf() is 0
PASS (new Number(.4)).valueOf() is 0.4
PASS (new Number('1.')).valueOf() is 1
PASS isNaN(new Number('a')) is true
PASS isNaN(Number.NaN) is true
PASS Number.NEGATIVE_INFINITY is -Infinity
PASS Number.POSITIVE_INFINITY is Infinity
PASS (1).toString() is '1'
PASS typeof (1).toString() is 'string'
PASS (10).toString(16) is 'a'
PASS (8.5).toString(16) is '8.8'
PASS (-8.5).toString(16) is '-8.8'
PASS Number.NaN.toString(16) is 'NaN'
PASS Number.POSITIVE_INFINITY.toString(16) is 'Infinity'
PASS Number.NEGATIVE_INFINITY.toString(16) is '-Infinity'
PASS Number.MAX_VALUE.toString(2).length is 1024
PASS (1).valueOf() is 1
PASS typeof (1).valueOf() is 'number'
PASS Number(1234.567).toFixed(0) is "1235"
PASS Number(1234.567).toFixed(undefined) is "1235"
PASS Number(-1234.567).toFixed(0) is "-1235"
PASS Number(-1234.567).toFixed(undefined) is "-1235"
PASS Number(0).toFixed(7) is "0.0000000"
PASS Number(0.003).toFixed(0) is "0"
PASS Number(-0.003).toFixed(0) is "-0"
PASS Number(40.1234567890123).toFixed(7) is "40.1234568"
PASS Number(-40.1234567890123).toFixed(7) is "-40.1234568"
PASS Number(4).toFixed(7) is "4.0000000"
PASS Number(-4).toFixed(7) is "-4.0000000"
PASS Number(0.000056).toFixed(7) is "0.0000560"
PASS Number(-0.000056).toFixed(7) is "-0.0000560"
PASS Number(NaN).toFixed(7) is "NaN"
PASS Number(Infinity).toFixed(7) is "Infinity"
PASS Number(-Infinity).toFixed(7) is "-Infinity"
PASS Number(Math.pow(10,4)).toFixed(13) is "10000.0000000000000"
PASS Number(Math.pow(10,17)).toFixed(16) is "100000000000000000.0000000000000000"
PASS Number(Math.pow(10,18)).toFixed(17) is "1000000000000000000.00000000000000000"
PASS Number(Math.pow(10,19)).toFixed(18) is "10000000000000000000.000000000000000000"
PASS Number(Math.pow(10,17)).toFixed(20) is "100000000000000000.00000000000000000000"
PASS Number(Math.pow(10,18)).toFixed(20) is "1000000000000000000.00000000000000000000"
PASS Number(Math.pow(10,19)).toFixed(20) is "10000000000000000000.00000000000000000000"
PASS Number(Math.pow(10,20)).toFixed(20) is "100000000000000000000.00000000000000000000"
PASS Number(Math.pow(10,21)).toFixed(20) is "1e+21"
PASS Number(-Math.pow(10,4)).toFixed(13) is "-10000.0000000000000"
PASS Number(-Math.pow(10,17)).toFixed(16) is "-100000000000000000.0000000000000000"
PASS Number(-Math.pow(10,18)).toFixed(17) is "-1000000000000000000.00000000000000000"
PASS Number(-Math.pow(10,19)).toFixed(18) is "-10000000000000000000.000000000000000000"
PASS Number(-Math.pow(10,17)).toFixed(20) is "-100000000000000000.00000000000000000000"
PASS Number(-Math.pow(10,18)).toFixed(20) is "-1000000000000000000.00000000000000000000"
PASS Number(-Math.pow(10,19)).toFixed(20) is "-10000000000000000000.00000000000000000000"
PASS Number(-Math.pow(10,20)).toFixed(20) is "-100000000000000000000.00000000000000000000"
PASS Number(-Math.pow(10,21)).toFixed(20) is "-1e+21"
PASS toFixedOrException(2,-1).indexOf('Range') >= 0 is true
PASS Number(2).toFixed(0) is "2"
PASS Number(2).toFixed(20) is "2.00000000000000000000"
PASS toFixedOrException(2,21).indexOf('Range') >= 0 is true
PASS toFixedOrException(-2,-1).indexOf('Range') >= 0 is true
PASS Number(-2).toFixed(0) is "-2"
PASS Number(-2).toFixed(20) is "-2.00000000000000000000"
PASS toFixedOrException(-2,21).indexOf('Range') >= 0 is true
PASS Number(NaN).toExponential() is "NaN"
PASS Number(Infinity).toExponential() is "Infinity"
PASS Number(-Infinity).toExponential() is "-Infinity"
PASS Number(NaN).toExponential(4) is "NaN"
PASS Number(Infinity).toExponential(4) is "Infinity"
PASS Number(-Infinity).toExponential(4) is "-Infinity"
PASS Number(123.456).toExponential() is "1.23456e+2"
PASS try { Number(123.456).toExponential(-1) } catch (e) { String(e).indexOf('Range') >= 0; } is true
PASS Number(123.456).toExponential(0) is "1e+2"
PASS Number(123.456).toExponential(1) is "1.2e+2"
PASS Number(123.456).toExponential(2) is "1.23e+2"
PASS Number(123.456).toExponential(3) is "1.235e+2"
PASS Number(123.456).toExponential(4) is "1.2346e+2"
PASS Number(123.456).toExponential(5) is "1.23456e+2"
PASS Number(123.456).toExponential(6) is "1.234560e+2"
PASS Number(123.456).toExponential(7) is "1.2345600e+2"
PASS Number(123.456).toExponential(8) is "1.23456000e+2"
PASS Number(123.456).toExponential(9) is "1.234560000e+2"
PASS Number(123.456).toExponential(10) is "1.2345600000e+2"
PASS Number(123.456).toExponential(11) is "1.23456000000e+2"
PASS Number(123.456).toExponential(12) is "1.234560000000e+2"
PASS Number(123.456).toExponential(13) is "1.2345600000000e+2"
PASS Number(123.456).toExponential(14) is "1.23456000000000e+2"
PASS Number(123.456).toExponential(15) is "1.234560000000000e+2"
PASS Number(123.456).toExponential(16) is "1.2345600000000000e+2"
PASS Number(123.456).toExponential(17) is "1.23456000000000003e+2"
PASS Number(123.456).toExponential(18) is "1.234560000000000031e+2"
PASS Number(123.456).toExponential(19) is "1.2345600000000000307e+2"
PASS Number(123.456).toExponential(20) is "1.23456000000000003070e+2"
PASS try { Number(123.456).toExponential(21) } catch (e) { String(e).indexOf('Range') >= 0; } is true
PASS Number(-123.456).toExponential() is "-1.23456e+2"
PASS try { Number(-123.456).toExponential(-1) } catch (e) { String(e).indexOf('Range') >= 0; } is true
PASS Number(-123.456).toExponential(0) is "-1e+2"
PASS Number(-123.456).toExponential(1) is "-1.2e+2"
PASS Number(-123.456).toExponential(2) is "-1.23e+2"
PASS Number(-123.456).toExponential(3) is "-1.235e+2"
PASS Number(-123.456).toExponential(4) is "-1.2346e+2"
PASS Number(-123.456).toExponential(5) is "-1.23456e+2"
PASS Number(-123.456).toExponential(6) is "-1.234560e+2"
PASS Number(-123.456).toExponential(7) is "-1.2345600e+2"
PASS Number(-123.456).toExponential(8) is "-1.23456000e+2"
PASS Number(-123.456).toExponential(9) is "-1.234560000e+2"
PASS Number(-123.456).toExponential(10) is "-1.2345600000e+2"
PASS Number(-123.456).toExponential(11) is "-1.23456000000e+2"
PASS Number(-123.456).toExponential(12) is "-1.234560000000e+2"
PASS Number(-123.456).toExponential(13) is "-1.2345600000000e+2"
PASS Number(-123.456).toExponential(14) is "-1.23456000000000e+2"
PASS Number(-123.456).toExponential(15) is "-1.234560000000000e+2"
PASS Number(-123.456).toExponential(16) is "-1.2345600000000000e+2"
PASS Number(-123.456).toExponential(17) is "-1.23456000000000003e+2"
PASS Number(-123.456).toExponential(18) is "-1.234560000000000031e+2"
PASS Number(-123.456).toExponential(19) is "-1.2345600000000000307e+2"
PASS Number(-123.456).toExponential(20) is "-1.23456000000000003070e+2"
PASS try { Number(-123.456).toExponential(21) } catch (e) { String(e).indexOf('Range') >= 0; } is true
PASS Number(.000123456).toExponential() is "1.23456e-4"
PASS try { Number(.000123456).toExponential(-1) } catch (e) { String(e).indexOf('Range') >= 0; } is true
PASS Number(.000123456).toExponential(0) is "1e-4"
PASS Number(.000123456).toExponential(1) is "1.2e-4"
PASS Number(.000123456).toExponential(2) is "1.23e-4"
PASS Number(.000123456).toExponential(3) is "1.235e-4"
PASS Number(.000123456).toExponential(4) is "1.2346e-4"
PASS Number(.000123456).toExponential(5) is "1.23456e-4"
PASS Number(.000123456).toExponential(6) is "1.234560e-4"
PASS Number(.000123456).toExponential(7) is "1.2345600e-4"
PASS Number(.000123456).toExponential(8) is "1.23456000e-4"
PASS Number(.000123456).toExponential(9) is "1.234560000e-4"
PASS Number(.000123456).toExponential(10) is "1.2345600000e-4"
PASS Number(.000123456).toExponential(11) is "1.23456000000e-4"
PASS Number(.000123456).toExponential(12) is "1.234560000000e-4"
PASS Number(.000123456).toExponential(13) is "1.2345600000000e-4"
PASS Number(.000123456).toExponential(14) is "1.23456000000000e-4"
PASS Number(.000123456).toExponential(15) is "1.234560000000000e-4"
PASS Number(.000123456).toExponential(16) is "1.2345600000000001e-4"
PASS Number(.000123456).toExponential(17) is "1.23456000000000005e-4"
PASS Number(.000123456).toExponential(18) is "1.234560000000000052e-4"
PASS Number(.000123456).toExponential(19) is "1.2345600000000000519e-4"
PASS Number(.000123456).toExponential(20) is "1.23456000000000005188e-4"
PASS try { Number(.000123456).toExponential(21) } catch (e) { String(e).indexOf('Range') >= 0; } is true
PASS Number(-.000123456).toExponential() is "-1.23456e-4"
PASS try { Number(-.000123456).toExponential(-1) } catch (e) { String(e).indexOf('Range') >= 0; } is true
PASS Number(-.000123456).toExponential(0) is "-1e-4"
PASS Number(-.000123456).toExponential(1) is "-1.2e-4"
PASS Number(-.000123456).toExponential(2) is "-1.23e-4"
PASS Number(-.000123456).toExponential(3) is "-1.235e-4"
PASS Number(-.000123456).toExponential(4) is "-1.2346e-4"
PASS Number(-.000123456).toExponential(5) is "-1.23456e-4"
PASS Number(-.000123456).toExponential(6) is "-1.234560e-4"
PASS Number(-.000123456).toExponential(7) is "-1.2345600e-4"
PASS Number(-.000123456).toExponential(8) is "-1.23456000e-4"
PASS Number(-.000123456).toExponential(9) is "-1.234560000e-4"
PASS Number(-.000123456).toExponential(10) is "-1.2345600000e-4"
PASS Number(-.000123456).toExponential(11) is "-1.23456000000e-4"
PASS Number(-.000123456).toExponential(12) is "-1.234560000000e-4"
PASS Number(-.000123456).toExponential(13) is "-1.2345600000000e-4"
PASS Number(-.000123456).toExponential(14) is "-1.23456000000000e-4"
PASS Number(-.000123456).toExponential(15) is "-1.234560000000000e-4"
PASS Number(-.000123456).toExponential(16) is "-1.2345600000000001e-4"
PASS Number(-.000123456).toExponential(17) is "-1.23456000000000005e-4"
PASS Number(-.000123456).toExponential(18) is "-1.234560000000000052e-4"
PASS Number(-.000123456).toExponential(19) is "-1.2345600000000000519e-4"
PASS Number(-.000123456).toExponential(20) is "-1.23456000000000005188e-4"
PASS try { Number(-.000123456).toExponential(21) } catch (e) { String(e).indexOf('Range') >= 0; } is true
PASS Number(123.4567890123456789012).toExponential() is "1.2345678901234568e+2"
PASS try { Number(123.4567890123456789012).toExponential(-1) } catch (e) { String(e).indexOf('Range') >= 0; } is true
PASS Number(123.4567890123456789012).toExponential(0) is "1e+2"
PASS Number(123.4567890123456789012).toExponential(1) is "1.2e+2"
PASS Number(123.4567890123456789012).toExponential(2) is "1.23e+2"
PASS Number(123.4567890123456789012).toExponential(3) is "1.235e+2"
PASS Number(123.4567890123456789012).toExponential(4) is "1.2346e+2"
PASS Number(123.4567890123456789012).toExponential(5) is "1.23457e+2"
PASS Number(123.4567890123456789012).toExponential(6) is "1.234568e+2"
PASS Number(123.4567890123456789012).toExponential(7) is "1.2345679e+2"
PASS Number(123.4567890123456789012).toExponential(8) is "1.23456789e+2"
PASS Number(123.4567890123456789012).toExponential(9) is "1.234567890e+2"
PASS Number(123.4567890123456789012).toExponential(10) is "1.2345678901e+2"
PASS Number(123.4567890123456789012).toExponential(11) is "1.23456789012e+2"
PASS Number(123.4567890123456789012).toExponential(12) is "1.234567890123e+2"
PASS Number(123.4567890123456789012).toExponential(13) is "1.2345678901235e+2"
PASS Number(123.4567890123456789012).toExponential(14) is "1.23456789012346e+2"
PASS Number(123.4567890123456789012).toExponential(15) is "1.234567890123457e+2"
PASS Number(123.4567890123456789012).toExponential(16) is "1.2345678901234568e+2"
PASS Number(123.4567890123456789012).toExponential(17) is "1.23456789012345681e+2"
PASS Number(123.4567890123456789012).toExponential(18) is "1.234567890123456806e+2"
PASS Number(123.4567890123456789012).toExponential(19) is "1.2345678901234568059e+2"
PASS Number(123.4567890123456789012).toExponential(20) is "1.23456789012345680590e+2"
PASS try { Number(123.4567890123456789012).toExponential(21) } catch (e) { String(e).indexOf('Range') >= 0; } is true
PASS Number(-123.4567890123456789012).toExponential() is "-1.2345678901234568e+2"
PASS try { Number(-123.4567890123456789012).toExponential(-1) } catch (e) { String(e).indexOf('Range') >= 0; } is true
PASS Number(-123.4567890123456789012).toExponential(0) is "-1e+2"
PASS Number(-123.4567890123456789012).toExponential(1) is "-1.2e+2"
PASS Number(-123.4567890123456789012).toExponential(2) is "-1.23e+2"
PASS Number(-123.4567890123456789012).toExponential(3) is "-1.235e+2"
PASS Number(-123.4567890123456789012).toExponential(4) is "-1.2346e+2"
PASS Number(-123.4567890123456789012).toExponential(5) is "-1.23457e+2"
PASS Number(-123.4567890123456789012).toExponential(6) is "-1.234568e+2"
PASS Number(-123.4567890123456789012).toExponential(7) is "-1.2345679e+2"
PASS Number(-123.4567890123456789012).toExponential(8) is "-1.23456789e+2"
PASS Number(-123.4567890123456789012).toExponential(9) is "-1.234567890e+2"
PASS Number(-123.4567890123456789012).toExponential(10) is "-1.2345678901e+2"
PASS Number(-123.4567890123456789012).toExponential(11) is "-1.23456789012e+2"
PASS Number(-123.4567890123456789012).toExponential(12) is "-1.234567890123e+2"
PASS Number(-123.4567890123456789012).toExponential(13) is "-1.2345678901235e+2"
PASS Number(-123.4567890123456789012).toExponential(14) is "-1.23456789012346e+2"
PASS Number(-123.4567890123456789012).toExponential(15) is "-1.234567890123457e+2"
PASS Number(-123.4567890123456789012).toExponential(16) is "-1.2345678901234568e+2"
PASS Number(-123.4567890123456789012).toExponential(17) is "-1.23456789012345681e+2"
PASS Number(-123.4567890123456789012).toExponential(18) is "-1.234567890123456806e+2"
PASS Number(-123.4567890123456789012).toExponential(19) is "-1.2345678901234568059e+2"
PASS Number(-123.4567890123456789012).toExponential(20) is "-1.23456789012345680590e+2"
PASS try { Number(-123.4567890123456789012).toExponential(21) } catch (e) { String(e).indexOf('Range') >= 0; } is true
PASS Number(.0000000000000000000001).toExponential() is "1e-22"
PASS Number(.0000000000000000000012).toExponential() is "1.2e-21"
PASS Number(.0000000000000000000123).toExponential() is "1.23e-20"
PASS Number(.0000000000000000000123).toExponential() is "1.23e-20"
PASS Number(.0000000000000000001234).toExponential() is "1.234e-19"
PASS Number(.0000000000000000012345).toExponential() is "1.2345e-18"
PASS Number(.0000000000000000123456).toExponential() is "1.23456e-17"
PASS Number(.0000000000000001234567).toExponential() is "1.234567e-16"
PASS Number(.0000000000000012345678).toExponential() is "1.2345678e-15"
PASS Number(.0000000000000123456789).toExponential() is "1.23456789e-14"
PASS Number(.0000000000001234567890).toExponential() is "1.23456789e-13"
PASS Number(.0000000000012345678901).toExponential() is "1.2345678901e-12"
PASS Number(.0000000000123456789012).toExponential() is "1.23456789012e-11"
PASS Number(.0000000001234567890123).toExponential() is "1.234567890123e-10"
PASS Number(.0000000012345678901234).toExponential() is "1.2345678901234e-9"
PASS Number(.0000000123456789012345).toExponential() is "1.23456789012345e-8"
PASS Number(.0000001234567890123456).toExponential() is "1.234567890123456e-7"
PASS Number(.0000012345678901234567).toExponential() is "1.2345678901234567e-6"
PASS Number(.0000123456789012345678).toExponential() is "1.2345678901234568e-5"
PASS Number(.0001234567890123456789).toExponential() is "1.2345678901234567e-4"
PASS Number(.0012345678901234567890).toExponential() is "1.2345678901234567e-3"
PASS Number(.0123456789012345678901).toExponential() is "1.2345678901234568e-2"
PASS Number(1.234567890123456789012).toExponential() is "1.2345678901234567e+0"
PASS Number(12.34567890123456789012).toExponential() is "1.2345678901234567e+1"
PASS Number(123.4567890123456789012).toExponential() is "1.2345678901234568e+2"
PASS Number(1234.567890123456789012).toExponential() is "1.234567890123457e+3"
PASS Number(12345.67890123456789012).toExponential() is "1.2345678901234567e+4"
PASS Number(123456.7890123456789012).toExponential() is "1.2345678901234567e+5"
PASS Number(1234567.890123456789012).toExponential() is "1.2345678901234567e+6"
PASS Number(12345678.90123456789012).toExponential() is "1.2345678901234567e+7"
PASS Number(123456789.0123456789012).toExponential() is "1.2345678901234567e+8"
PASS Number(1234567890.123456789012).toExponential() is "1.2345678901234567e+9"
PASS Number(12345678901.23456789012).toExponential() is "1.2345678901234568e+10"
PASS Number(123456789012.3456789012).toExponential() is "1.2345678901234567e+11"
PASS Number(1234567890123.456789012).toExponential() is "1.2345678901234568e+12"
PASS Number(12345678901234.56789012).toExponential() is "1.2345678901234568e+13"
PASS Number(123456789012345.6789012).toExponential() is "1.2345678901234567e+14"
PASS Number(1234567890123456.789012).toExponential() is "1.2345678901234568e+15"
PASS Number(12345678901234567.89012).toExponential() is "1.2345678901234568e+16"
PASS Number(123456789012345678.9012).toExponential() is "1.2345678901234568e+17"
PASS Number(1234567890123456789.012).toExponential() is "1.2345678901234568e+18"
PASS Number(12345678901234567890.12).toExponential() is "1.2345678901234567e+19"
PASS Number(123456789012345678901.2).toExponential() is "1.2345678901234568e+20"
PASS Number(-.0000000000000000000001).toExponential() is "-1e-22"
PASS Number(-.0000000000000000000012).toExponential() is "-1.2e-21"
PASS Number(-.0000000000000000000123).toExponential() is "-1.23e-20"
PASS Number(-.0000000000000000000123).toExponential() is "-1.23e-20"
PASS Number(-.0000000000000000001234).toExponential() is "-1.234e-19"
PASS Number(-.0000000000000000012345).toExponential() is "-1.2345e-18"
PASS Number(-.0000000000000000123456).toExponential() is "-1.23456e-17"
PASS Number(-.0000000000000001234567).toExponential() is "-1.234567e-16"
PASS Number(-.0000000000000012345678).toExponential() is "-1.2345678e-15"
PASS Number(-.0000000000000123456789).toExponential() is "-1.23456789e-14"
PASS Number(-.0000000000001234567890).toExponential() is "-1.23456789e-13"
PASS Number(-.0000000000012345678901).toExponential() is "-1.2345678901e-12"
PASS Number(-.0000000000123456789012).toExponential() is "-1.23456789012e-11"
PASS Number(-.0000000001234567890123).toExponential() is "-1.234567890123e-10"
PASS Number(-.0000000012345678901234).toExponential() is "-1.2345678901234e-9"
PASS Number(-.0000000123456789012345).toExponential() is "-1.23456789012345e-8"
PASS Number(-.0000001234567890123456).toExponential() is "-1.234567890123456e-7"
PASS Number(-.0000012345678901234567).toExponential() is "-1.2345678901234567e-6"
PASS Number(-.0000123456789012345678).toExponential() is "-1.2345678901234568e-5"
PASS Number(-.0001234567890123456789).toExponential() is "-1.2345678901234567e-4"
PASS Number(-.0012345678901234567890).toExponential() is "-1.2345678901234567e-3"
PASS Number(-.0123456789012345678901).toExponential() is "-1.2345678901234568e-2"
PASS Number(-1.234567890123456789012).toExponential() is "-1.2345678901234567e+0"
PASS Number(-12.34567890123456789012).toExponential() is "-1.2345678901234567e+1"
PASS Number(-123.4567890123456789012).toExponential() is "-1.2345678901234568e+2"
PASS Number(-1234.567890123456789012).toExponential() is "-1.234567890123457e+3"
PASS Number(-12345.67890123456789012).toExponential() is "-1.2345678901234567e+4"
PASS Number(-123456.7890123456789012).toExponential() is "-1.2345678901234567e+5"
PASS Number(-1234567.890123456789012).toExponential() is "-1.2345678901234567e+6"
PASS Number(-12345678.90123456789012).toExponential() is "-1.2345678901234567e+7"
PASS Number(-123456789.0123456789012).toExponential() is "-1.2345678901234567e+8"
PASS Number(-1234567890.123456789012).toExponential() is "-1.2345678901234567e+9"
PASS Number(-12345678901.23456789012).toExponential() is "-1.2345678901234568e+10"
PASS Number(-123456789012.3456789012).toExponential() is "-1.2345678901234567e+11"
PASS Number(-1234567890123.456789012).toExponential() is "-1.2345678901234568e+12"
PASS Number(-12345678901234.56789012).toExponential() is "-1.2345678901234568e+13"
PASS Number(-123456789012345.6789012).toExponential() is "-1.2345678901234567e+14"
PASS Number(-1234567890123456.789012).toExponential() is "-1.2345678901234568e+15"
PASS Number(-12345678901234567.89012).toExponential() is "-1.2345678901234568e+16"
PASS Number(-123456789012345678.9012).toExponential() is "-1.2345678901234568e+17"
PASS Number(-1234567890123456789.012).toExponential() is "-1.2345678901234568e+18"
PASS Number(-12345678901234567890.12).toExponential() is "-1.2345678901234567e+19"
PASS Number(-123456789012345678901.2).toExponential() is "-1.2345678901234568e+20"
PASS try { Number(1).toPrecision(-1); } catch (e) { String(e).indexOf('Range') >= 0; } is true
PASS try { Number(1).toPrecision(0); } catch (e) { String(e).indexOf('Range') >= 0; } is true
PASS try { Number(1).toPrecision(1); } catch (e) { String(e); } is "1"
PASS try { Number(1).toPrecision(21); } catch (e) { String(e); } is "1.00000000000000000000"
PASS try { Number(1).toPrecision(22); } catch (e) { String(e).indexOf('Range') >= 0; } is true
PASS Number(NaN).toPrecision() is "NaN"
PASS Number(NaN).toPrecision(1) is "NaN"
PASS Number(Infinity).toPrecision() is "Infinity"
PASS Number(Infinity).toPrecision(1) is "Infinity"
PASS Number(-Infinity).toPrecision() is "-Infinity"
PASS Number(-Infinity).toPrecision(1) is "-Infinity"
PASS Number(.0000000012345).toPrecision(2) is "1.2e-9"
PASS Number(.000000012345).toPrecision(2) is "1.2e-8"
PASS Number(.00000012345).toPrecision(2) is "1.2e-7"
PASS Number(.0000012345).toPrecision(2) is "0.0000012"
PASS Number(.000012345).toPrecision(2) is "0.000012"
PASS Number(.00012345).toPrecision(2) is "0.00012"
PASS Number(.0012345).toPrecision(2) is "0.0012"
PASS Number(.012345).toPrecision(2) is "0.012"
PASS Number(.12345).toPrecision(2) is "0.12"
PASS Number(1.2345).toPrecision(2) is "1.2"
PASS Number(12.345).toPrecision(2) is "12"
PASS Number(123.45).toPrecision(2) is "1.2e+2"
PASS Number(1234.5).toPrecision(2) is "1.2e+3"
PASS Number(12345).toPrecision(2) is "1.2e+4"
PASS Number(12345.67).toPrecision(4) is "1.235e+4"
PASS Number(12344.67).toPrecision(4) is "1.234e+4"
PASS Number(0.0001234567890123456789012345).toPrecision() is "0.00012345678901234567"
PASS Number(0.0001234567890123456789012345).toPrecision(1) is "0.0001"
PASS Number(0.0001234567890123456789012345).toPrecision(2) is "0.00012"
PASS Number(0.0001234567890123456789012345).toPrecision(3) is "0.000123"
PASS Number(0.0001234567890123456789012345).toPrecision(4) is "0.0001235"
PASS Number(0.0001234567890123456789012345).toPrecision(5) is "0.00012346"
PASS Number(0.0001234567890123456789012345).toPrecision(6) is "0.000123457"
PASS Number(0.0001234567890123456789012345).toPrecision(7) is "0.0001234568"
PASS Number(0.0001234567890123456789012345).toPrecision(8) is "0.00012345679"
PASS Number(0.0001234567890123456789012345).toPrecision(9) is "0.000123456789"
PASS Number(0.0001234567890123456789012345).toPrecision(10) is "0.0001234567890"
PASS Number(0.0001234567890123456789012345).toPrecision(11) is "0.00012345678901"
PASS Number(0.0001234567890123456789012345).toPrecision(12) is "0.000123456789012"
PASS Number(0.0001234567890123456789012345).toPrecision(13) is "0.0001234567890123"
PASS Number(0.0001234567890123456789012345).toPrecision(14) is "0.00012345678901235"
PASS Number(0.0001234567890123456789012345).toPrecision(15) is "0.000123456789012346"
PASS Number(0.0001234567890123456789012345).toPrecision(16) is "0.0001234567890123457"
PASS Number(0.0001234567890123456789012345).toPrecision(17) is "0.00012345678901234567"
PASS Number(0.0001234567890123456789012345).toPrecision(18) is "0.000123456789012345671"
PASS Number(0.0001234567890123456789012345).toPrecision(19) is "0.0001234567890123456713"
PASS Number(0.0001234567890123456789012345).toPrecision(20) is "0.00012345678901234567130"
PASS Number(0.0001234567890123456789012345).toPrecision(21) is "0.000123456789012345671298"
PASS Number(12345.67890123456789012345).toPrecision() is "12345.678901234567"
PASS Number(12345.67890123456789012345).toPrecision(1) is "1e+4"
PASS Number(12345.67890123456789012345).toPrecision(2) is "1.2e+4"
PASS Number(12345.67890123456789012345).toPrecision(3) is "1.23e+4"
PASS Number(12345.67890123456789012345).toPrecision(4) is "1.235e+4"
PASS Number(12345.67890123456789012345).toPrecision(5) is "12346"
PASS Number(12345.67890123456789012345).toPrecision(6) is "12345.7"
PASS Number(12345.67890123456789012345).toPrecision(7) is "12345.68"
PASS Number(12345.67890123456789012345).toPrecision(8) is "12345.679"
PASS Number(12345.67890123456789012345).toPrecision(9) is "12345.6789"
PASS Number(12345.67890123456789012345).toPrecision(10) is "12345.67890"
PASS Number(12345.67890123456789012345).toPrecision(11) is "12345.678901"
PASS Number(12345.67890123456789012345).toPrecision(12) is "12345.6789012"
PASS Number(12345.67890123456789012345).toPrecision(13) is "12345.67890123"
PASS Number(12345.67890123456789012345).toPrecision(14) is "12345.678901235"
PASS Number(12345.67890123456789012345).toPrecision(15) is "12345.6789012346"
PASS Number(12345.67890123456789012345).toPrecision(16) is "12345.67890123457"
PASS Number(12345.67890123456789012345).toPrecision(17) is "12345.678901234567"
PASS Number(12345.67890123456789012345).toPrecision(18) is "12345.6789012345671"
PASS Number(12345.67890123456789012345).toPrecision(19) is "12345.67890123456709"
PASS Number(12345.67890123456789012345).toPrecision(20) is "12345.678901234567093"
PASS Number(12345.67890123456789012345).toPrecision(21) is "12345.6789012345670926"
PASS Number(-.0000000012345).toPrecision(2) is "-1.2e-9"
PASS Number(-.000000012345).toPrecision(2) is "-1.2e-8"
PASS Number(-.00000012345).toPrecision(2) is "-1.2e-7"
PASS Number(-.0000012345).toPrecision(2) is "-0.0000012"
PASS Number(-.000012345).toPrecision(2) is "-0.000012"
PASS Number(-.00012345).toPrecision(2) is "-0.00012"
PASS Number(-.0012345).toPrecision(2) is "-0.0012"
PASS Number(-.012345).toPrecision(2) is "-0.012"
PASS Number(-.12345).toPrecision(2) is "-0.12"
PASS Number(-1.2345).toPrecision(2) is "-1.2"
PASS Number(-12.345).toPrecision(2) is "-12"
PASS Number(-123.45).toPrecision(2) is "-1.2e+2"
PASS Number(-1234.5).toPrecision(2) is "-1.2e+3"
PASS Number(-12345).toPrecision(2) is "-1.2e+4"
PASS Number(-12345.67).toPrecision(4) is "-1.235e+4"
PASS Number(-12344.67).toPrecision(4) is "-1.234e+4"
PASS Number(-0.0001234567890123456789012345).toPrecision() is "-0.00012345678901234567"
PASS Number(-0.0001234567890123456789012345).toPrecision(1) is "-0.0001"
PASS Number(-0.0001234567890123456789012345).toPrecision(2) is "-0.00012"
PASS Number(-0.0001234567890123456789012345).toPrecision(3) is "-0.000123"
PASS Number(-0.0001234567890123456789012345).toPrecision(4) is "-0.0001235"
PASS Number(-0.0001234567890123456789012345).toPrecision(5) is "-0.00012346"
PASS Number(-0.0001234567890123456789012345).toPrecision(6) is "-0.000123457"
PASS Number(-0.0001234567890123456789012345).toPrecision(7) is "-0.0001234568"
PASS Number(-0.0001234567890123456789012345).toPrecision(8) is "-0.00012345679"
PASS Number(-0.0001234567890123456789012345).toPrecision(9) is "-0.000123456789"
PASS Number(-0.0001234567890123456789012345).toPrecision(10) is "-0.0001234567890"
PASS Number(-0.0001234567890123456789012345).toPrecision(11) is "-0.00012345678901"
PASS Number(-0.0001234567890123456789012345).toPrecision(12) is "-0.000123456789012"
PASS Number(-0.0001234567890123456789012345).toPrecision(13) is "-0.0001234567890123"
PASS Number(-0.0001234567890123456789012345).toPrecision(14) is "-0.00012345678901235"
PASS Number(-0.0001234567890123456789012345).toPrecision(15) is "-0.000123456789012346"
PASS Number(-0.0001234567890123456789012345).toPrecision(16) is "-0.0001234567890123457"
PASS Number(-0.0001234567890123456789012345).toPrecision(17) is "-0.00012345678901234567"
PASS Number(-0.0001234567890123456789012345).toPrecision(18) is "-0.000123456789012345671"
PASS Number(-0.0001234567890123456789012345).toPrecision(19) is "-0.0001234567890123456713"
PASS Number(-0.0001234567890123456789012345).toPrecision(20) is "-0.00012345678901234567130"
PASS Number(-0.0001234567890123456789012345).toPrecision(21) is "-0.000123456789012345671298"
PASS Number(-12345.67890123456789012345).toPrecision() is "-12345.678901234567"
PASS Number(-12345.67890123456789012345).toPrecision(1) is "-1e+4"
PASS Number(-12345.67890123456789012345).toPrecision(2) is "-1.2e+4"
PASS Number(-12345.67890123456789012345).toPrecision(3) is "-1.23e+4"
PASS Number(-12345.67890123456789012345).toPrecision(4) is "-1.235e+4"
PASS Number(-12345.67890123456789012345).toPrecision(5) is "-12346"
PASS Number(-12345.67890123456789012345).toPrecision(6) is "-12345.7"
PASS Number(-12345.67890123456789012345).toPrecision(7) is "-12345.68"
PASS Number(-12345.67890123456789012345).toPrecision(8) is "-12345.679"
PASS Number(-12345.67890123456789012345).toPrecision(9) is "-12345.6789"
PASS Number(-12345.67890123456789012345).toPrecision(10) is "-12345.67890"
PASS Number(-12345.67890123456789012345).toPrecision(11) is "-12345.678901"
PASS Number(-12345.67890123456789012345).toPrecision(12) is "-12345.6789012"
PASS Number(-12345.67890123456789012345).toPrecision(13) is "-12345.67890123"
PASS Number(-12345.67890123456789012345).toPrecision(14) is "-12345.678901235"
PASS Number(-12345.67890123456789012345).toPrecision(15) is "-12345.6789012346"
PASS Number(-12345.67890123456789012345).toPrecision(16) is "-12345.67890123457"
PASS Number(-12345.67890123456789012345).toPrecision(17) is "-12345.678901234567"
PASS Number(-12345.67890123456789012345).toPrecision(18) is "-12345.6789012345671"
PASS Number(-12345.67890123456789012345).toPrecision(19) is "-12345.67890123456709"
PASS Number(-12345.67890123456789012345).toPrecision(20) is "-12345.678901234567093"
PASS Number(-12345.67890123456789012345).toPrecision(21) is "-12345.6789012345670926"
PASS Number(0).toPrecision() is "0"
PASS Number(0).toPrecision(1) is "0"
PASS Number(0).toPrecision(2) is "0.0"
PASS Number(0).toPrecision(3) is "0.00"
PASS Number(0).toPrecision(4) is "0.000"
PASS Number(0).toPrecision(5) is "0.0000"
PASS Number(0).toPrecision(6) is "0.00000"
PASS Number(0).toPrecision(7) is "0.000000"
PASS Number(0).toPrecision(8) is "0.0000000"
PASS Number(0).toPrecision(9) is "0.00000000"
PASS Number(0).toPrecision(10) is "0.000000000"
PASS Number(0).toPrecision(11) is "0.0000000000"
PASS Number(0).toPrecision(12) is "0.00000000000"
PASS Number(0).toPrecision(13) is "0.000000000000"
PASS Number(0).toPrecision(14) is "0.0000000000000"
PASS Number(0).toPrecision(15) is "0.00000000000000"
PASS Number(0).toPrecision(16) is "0.000000000000000"
PASS Number(0).toPrecision(17) is "0.0000000000000000"
PASS Number(0).toPrecision(18) is "0.00000000000000000"
PASS Number(0).toPrecision(19) is "0.000000000000000000"
PASS Number(0).toPrecision(20) is "0.0000000000000000000"
PASS Number(0).toPrecision(21) is "0.00000000000000000000"
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
shouldBe("Number()", "0");
shouldBe("Number(1)", "1");
shouldBe("Number(1.1)", "1.1");
shouldBe("Number('1.2')", "1.2");
shouldBe("isNaN(Number('a'))", "true");
shouldBe("(new Number()).valueOf()", "0");
shouldBe("(new Number(.4)).valueOf()", "0.4");
shouldBe("(new Number('1.')).valueOf()", "1");
shouldBe("isNaN(new Number('a'))", "true");
shouldBe("isNaN(Number.NaN)", "true");
shouldBe("Number.NEGATIVE_INFINITY", "-Infinity");
shouldBe("Number.POSITIVE_INFINITY", "Infinity");
shouldBe("(1).toString()", "'1'");
shouldBe("typeof (1).toString()", "'string'");
shouldBe("(10).toString(16)", "'a'");
shouldBe("(8.5).toString(16)", "'8.8'");
shouldBe("(-8.5).toString(16)", "'-8.8'");
shouldBe("Number.NaN.toString(16)", "'NaN'");
shouldBe("Number.POSITIVE_INFINITY.toString(16)", "'Infinity'");
shouldBe("Number.NEGATIVE_INFINITY.toString(16)", "'-Infinity'");
shouldBe("Number.MAX_VALUE.toString(2).length", "1024");
shouldBe("(1).valueOf()", "1");
shouldBe("typeof (1).valueOf()", "'number'");
function toFixedOrException(val,fractionDigits)
{
var s = "";
try {
s = String(Number(val).toFixed(fractionDigits));
}
catch (e) {
s = String(e);
}
return s;
}
shouldBe("Number(1234.567).toFixed(0)","\"1235\"");
shouldBe("Number(1234.567).toFixed(undefined)","\"1235\"");
shouldBe("Number(-1234.567).toFixed(0)","\"-1235\"");
shouldBe("Number(-1234.567).toFixed(undefined)","\"-1235\"");
shouldBe("Number(0).toFixed(7)","\"0.0000000\"");
shouldBe("Number(0.003).toFixed(0)","\"0\"");
shouldBe("Number(-0.003).toFixed(0)","\"-0\"");
shouldBe("Number(40.1234567890123).toFixed(7)","\"40.1234568\"");
shouldBe("Number(-40.1234567890123).toFixed(7)","\"-40.1234568\"");
shouldBe("Number(4).toFixed(7)","\"4.0000000\"");
shouldBe("Number(-4).toFixed(7)","\"-4.0000000\"");
shouldBe("Number(0.000056).toFixed(7)","\"0.0000560\"");
shouldBe("Number(-0.000056).toFixed(7)","\"-0.0000560\"");
shouldBe("Number(NaN).toFixed(7)","\"NaN\"");
shouldBe("Number(Infinity).toFixed(7)","\"Infinity\"");
shouldBe("Number(-Infinity).toFixed(7)","\"-Infinity\"");
shouldBe("Number(Math.pow(10,4)).toFixed(13)","\"10000.0000000000000\"");
shouldBe("Number(Math.pow(10,17)).toFixed(16)","\"100000000000000000.0000000000000000\"");
shouldBe("Number(Math.pow(10,18)).toFixed(17)","\"1000000000000000000.00000000000000000\"");
shouldBe("Number(Math.pow(10,19)).toFixed(18)","\"10000000000000000000.000000000000000000\"");
shouldBe("Number(Math.pow(10,17)).toFixed(20)","\"100000000000000000.00000000000000000000\"");
shouldBe("Number(Math.pow(10,18)).toFixed(20)","\"1000000000000000000.00000000000000000000\"");
shouldBe("Number(Math.pow(10,19)).toFixed(20)","\"10000000000000000000.00000000000000000000\"");
shouldBe("Number(Math.pow(10,20)).toFixed(20)","\"100000000000000000000.00000000000000000000\"");
shouldBe("Number(Math.pow(10,21)).toFixed(20)","\"1e+21\"");
shouldBe("Number(-Math.pow(10,4)).toFixed(13)","\"-10000.0000000000000\"");
shouldBe("Number(-Math.pow(10,17)).toFixed(16)","\"-100000000000000000.0000000000000000\"");
shouldBe("Number(-Math.pow(10,18)).toFixed(17)","\"-1000000000000000000.00000000000000000\"");
shouldBe("Number(-Math.pow(10,19)).toFixed(18)","\"-10000000000000000000.000000000000000000\"");
shouldBe("Number(-Math.pow(10,17)).toFixed(20)","\"-100000000000000000.00000000000000000000\"");
shouldBe("Number(-Math.pow(10,18)).toFixed(20)","\"-1000000000000000000.00000000000000000000\"");
shouldBe("Number(-Math.pow(10,19)).toFixed(20)","\"-10000000000000000000.00000000000000000000\"");
shouldBe("Number(-Math.pow(10,20)).toFixed(20)","\"-100000000000000000000.00000000000000000000\"");
shouldBe("Number(-Math.pow(10,21)).toFixed(20)","\"-1e+21\"");
shouldBeTrue("toFixedOrException(2,-1).indexOf('Range') >= 0");
shouldBe("Number(2).toFixed(0)","\"2\"");
shouldBe("Number(2).toFixed(20)","\"2.00000000000000000000\"");
shouldBeTrue("toFixedOrException(2,21).indexOf('Range') >= 0");
shouldBeTrue("toFixedOrException(-2,-1).indexOf('Range') >= 0");
shouldBe("Number(-2).toFixed(0)","\"-2\"");
shouldBe("Number(-2).toFixed(20)","\"-2.00000000000000000000\"");
shouldBeTrue("toFixedOrException(-2,21).indexOf('Range') >= 0");
shouldBe("Number(NaN).toExponential()","\"NaN\"");
shouldBe("Number(Infinity).toExponential()","\"Infinity\"");
shouldBe("Number(-Infinity).toExponential()","\"-Infinity\"");
shouldBe("Number(NaN).toExponential(4)","\"NaN\"");
shouldBe("Number(Infinity).toExponential(4)","\"Infinity\"");
shouldBe("Number(-Infinity).toExponential(4)","\"-Infinity\"");
shouldBe("Number(123.456).toExponential()","\"1.23456e+2\"");
shouldBeTrue("try { Number(123.456).toExponential(-1) } catch (e) { String(e).indexOf('Range') >= 0; }");
shouldBe("Number(123.456).toExponential(0)","\"1e+2\"");
shouldBe("Number(123.456).toExponential(1)","\"1.2e+2\"");
shouldBe("Number(123.456).toExponential(2)","\"1.23e+2\"");
shouldBe("Number(123.456).toExponential(3)","\"1.235e+2\"");
shouldBe("Number(123.456).toExponential(4)","\"1.2346e+2\"");
shouldBe("Number(123.456).toExponential(5)","\"1.23456e+2\"");
shouldBe("Number(123.456).toExponential(6)","\"1.234560e+2\"");
shouldBe("Number(123.456).toExponential(7)","\"1.2345600e+2\"");
shouldBe("Number(123.456).toExponential(8)","\"1.23456000e+2\"");
shouldBe("Number(123.456).toExponential(9)","\"1.234560000e+2\"");
shouldBe("Number(123.456).toExponential(10)","\"1.2345600000e+2\"");
shouldBe("Number(123.456).toExponential(11)","\"1.23456000000e+2\"");
shouldBe("Number(123.456).toExponential(12)","\"1.234560000000e+2\"");
shouldBe("Number(123.456).toExponential(13)","\"1.2345600000000e+2\"");
shouldBe("Number(123.456).toExponential(14)","\"1.23456000000000e+2\"");
shouldBe("Number(123.456).toExponential(15)","\"1.234560000000000e+2\"");
shouldBe("Number(123.456).toExponential(16)","\"1.2345600000000000e+2\"");
shouldBe("Number(123.456).toExponential(17)","\"1.23456000000000003e+2\"");
shouldBe("Number(123.456).toExponential(18)","\"1.234560000000000031e+2\"");
shouldBe("Number(123.456).toExponential(19)","\"1.2345600000000000307e+2\"");
shouldBe("Number(123.456).toExponential(20)","\"1.23456000000000003070e+2\"");
shouldBeTrue("try { Number(123.456).toExponential(21) } catch (e) { String(e).indexOf('Range') >= 0; }");
shouldBe("Number(-123.456).toExponential()","\"-1.23456e+2\"");
shouldBeTrue("try { Number(-123.456).toExponential(-1) } catch (e) { String(e).indexOf('Range') >= 0; }");
shouldBe("Number(-123.456).toExponential(0)","\"-1e+2\"");
shouldBe("Number(-123.456).toExponential(1)","\"-1.2e+2\"");
shouldBe("Number(-123.456).toExponential(2)","\"-1.23e+2\"");
shouldBe("Number(-123.456).toExponential(3)","\"-1.235e+2\"");
shouldBe("Number(-123.456).toExponential(4)","\"-1.2346e+2\"");
shouldBe("Number(-123.456).toExponential(5)","\"-1.23456e+2\"");
shouldBe("Number(-123.456).toExponential(6)","\"-1.234560e+2\"");
shouldBe("Number(-123.456).toExponential(7)","\"-1.2345600e+2\"");
shouldBe("Number(-123.456).toExponential(8)","\"-1.23456000e+2\"");
shouldBe("Number(-123.456).toExponential(9)","\"-1.234560000e+2\"");
shouldBe("Number(-123.456).toExponential(10)","\"-1.2345600000e+2\"");
shouldBe("Number(-123.456).toExponential(11)","\"-1.23456000000e+2\"");
shouldBe("Number(-123.456).toExponential(12)","\"-1.234560000000e+2\"");
shouldBe("Number(-123.456).toExponential(13)","\"-1.2345600000000e+2\"");
shouldBe("Number(-123.456).toExponential(14)","\"-1.23456000000000e+2\"");
shouldBe("Number(-123.456).toExponential(15)","\"-1.234560000000000e+2\"");
shouldBe("Number(-123.456).toExponential(16)","\"-1.2345600000000000e+2\"");
shouldBe("Number(-123.456).toExponential(17)","\"-1.23456000000000003e+2\"");
shouldBe("Number(-123.456).toExponential(18)","\"-1.234560000000000031e+2\"");
shouldBe("Number(-123.456).toExponential(19)","\"-1.2345600000000000307e+2\"");
shouldBe("Number(-123.456).toExponential(20)","\"-1.23456000000000003070e+2\"");
shouldBeTrue("try { Number(-123.456).toExponential(21) } catch (e) { String(e).indexOf('Range') >= 0; }");
shouldBe("Number(.000123456).toExponential()","\"1.23456e-4\"");
shouldBeTrue("try { Number(.000123456).toExponential(-1) } catch (e) { String(e).indexOf('Range') >= 0; }");
shouldBe("Number(.000123456).toExponential(0)","\"1e-4\"");
shouldBe("Number(.000123456).toExponential(1)","\"1.2e-4\"");
shouldBe("Number(.000123456).toExponential(2)","\"1.23e-4\"");
shouldBe("Number(.000123456).toExponential(3)","\"1.235e-4\"");
shouldBe("Number(.000123456).toExponential(4)","\"1.2346e-4\"");
shouldBe("Number(.000123456).toExponential(5)","\"1.23456e-4\"");
shouldBe("Number(.000123456).toExponential(6)","\"1.234560e-4\"");
shouldBe("Number(.000123456).toExponential(7)","\"1.2345600e-4\"");
shouldBe("Number(.000123456).toExponential(8)","\"1.23456000e-4\"");
shouldBe("Number(.000123456).toExponential(9)","\"1.234560000e-4\"");
shouldBe("Number(.000123456).toExponential(10)","\"1.2345600000e-4\"");
shouldBe("Number(.000123456).toExponential(11)","\"1.23456000000e-4\"");
shouldBe("Number(.000123456).toExponential(12)","\"1.234560000000e-4\"");
shouldBe("Number(.000123456).toExponential(13)","\"1.2345600000000e-4\"");
shouldBe("Number(.000123456).toExponential(14)","\"1.23456000000000e-4\"");
shouldBe("Number(.000123456).toExponential(15)","\"1.234560000000000e-4\"");
shouldBe("Number(.000123456).toExponential(16)","\"1.2345600000000001e-4\"");
shouldBe("Number(.000123456).toExponential(17)","\"1.23456000000000005e-4\"");
shouldBe("Number(.000123456).toExponential(18)","\"1.234560000000000052e-4\"");
shouldBe("Number(.000123456).toExponential(19)","\"1.2345600000000000519e-4\"");
shouldBe("Number(.000123456).toExponential(20)","\"1.23456000000000005188e-4\"");
shouldBeTrue("try { Number(.000123456).toExponential(21) } catch (e) { String(e).indexOf('Range') >= 0; }");
shouldBe("Number(-.000123456).toExponential()","\"-1.23456e-4\"");
shouldBeTrue("try { Number(-.000123456).toExponential(-1) } catch (e) { String(e).indexOf('Range') >= 0; }");
shouldBe("Number(-.000123456).toExponential(0)","\"-1e-4\"");
shouldBe("Number(-.000123456).toExponential(1)","\"-1.2e-4\"");
shouldBe("Number(-.000123456).toExponential(2)","\"-1.23e-4\"");
shouldBe("Number(-.000123456).toExponential(3)","\"-1.235e-4\"");
shouldBe("Number(-.000123456).toExponential(4)","\"-1.2346e-4\"");
shouldBe("Number(-.000123456).toExponential(5)","\"-1.23456e-4\"");
shouldBe("Number(-.000123456).toExponential(6)","\"-1.234560e-4\"");
shouldBe("Number(-.000123456).toExponential(7)","\"-1.2345600e-4\"");
shouldBe("Number(-.000123456).toExponential(8)","\"-1.23456000e-4\"");
shouldBe("Number(-.000123456).toExponential(9)","\"-1.234560000e-4\"");
shouldBe("Number(-.000123456).toExponential(10)","\"-1.2345600000e-4\"");
shouldBe("Number(-.000123456).toExponential(11)","\"-1.23456000000e-4\"");
shouldBe("Number(-.000123456).toExponential(12)","\"-1.234560000000e-4\"");
shouldBe("Number(-.000123456).toExponential(13)","\"-1.2345600000000e-4\"");
shouldBe("Number(-.000123456).toExponential(14)","\"-1.23456000000000e-4\"");
shouldBe("Number(-.000123456).toExponential(15)","\"-1.234560000000000e-4\"");
shouldBe("Number(-.000123456).toExponential(16)","\"-1.2345600000000001e-4\"");
shouldBe("Number(-.000123456).toExponential(17)","\"-1.23456000000000005e-4\"");
shouldBe("Number(-.000123456).toExponential(18)","\"-1.234560000000000052e-4\"");
shouldBe("Number(-.000123456).toExponential(19)","\"-1.2345600000000000519e-4\"");
shouldBe("Number(-.000123456).toExponential(20)","\"-1.23456000000000005188e-4\"");
shouldBeTrue("try { Number(-.000123456).toExponential(21) } catch (e) { String(e).indexOf('Range') >= 0; }");
shouldBe("Number(123.4567890123456789012).toExponential()","\"1.2345678901234568e+2\"");
shouldBeTrue("try { Number(123.4567890123456789012).toExponential(-1) } catch (e) { String(e).indexOf('Range') >= 0; }");
shouldBe("Number(123.4567890123456789012).toExponential(0)","\"1e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(1)","\"1.2e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(2)","\"1.23e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(3)","\"1.235e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(4)","\"1.2346e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(5)","\"1.23457e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(6)","\"1.234568e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(7)","\"1.2345679e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(8)","\"1.23456789e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(9)","\"1.234567890e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(10)","\"1.2345678901e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(11)","\"1.23456789012e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(12)","\"1.234567890123e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(13)","\"1.2345678901235e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(14)","\"1.23456789012346e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(15)","\"1.234567890123457e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(16)","\"1.2345678901234568e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(17)","\"1.23456789012345681e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(18)","\"1.234567890123456806e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(19)","\"1.2345678901234568059e+2\"");
shouldBe("Number(123.4567890123456789012).toExponential(20)","\"1.23456789012345680590e+2\"");
shouldBeTrue("try { Number(123.4567890123456789012).toExponential(21) } catch (e) { String(e).indexOf('Range') >= 0; }");
shouldBe("Number(-123.4567890123456789012).toExponential()","\"-1.2345678901234568e+2\"");
shouldBeTrue("try { Number(-123.4567890123456789012).toExponential(-1) } catch (e) { String(e).indexOf('Range') >= 0; }");
shouldBe("Number(-123.4567890123456789012).toExponential(0)","\"-1e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(1)","\"-1.2e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(2)","\"-1.23e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(3)","\"-1.235e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(4)","\"-1.2346e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(5)","\"-1.23457e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(6)","\"-1.234568e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(7)","\"-1.2345679e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(8)","\"-1.23456789e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(9)","\"-1.234567890e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(10)","\"-1.2345678901e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(11)","\"-1.23456789012e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(12)","\"-1.234567890123e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(13)","\"-1.2345678901235e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(14)","\"-1.23456789012346e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(15)","\"-1.234567890123457e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(16)","\"-1.2345678901234568e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(17)","\"-1.23456789012345681e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(18)","\"-1.234567890123456806e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(19)","\"-1.2345678901234568059e+2\"");
shouldBe("Number(-123.4567890123456789012).toExponential(20)","\"-1.23456789012345680590e+2\"");
shouldBeTrue("try { Number(-123.4567890123456789012).toExponential(21) } catch (e) { String(e).indexOf('Range') >= 0; }");
shouldBe("Number(.0000000000000000000001).toExponential()","\"1e-22\"");
shouldBe("Number(.0000000000000000000012).toExponential()","\"1.2e-21\"");
shouldBe("Number(.0000000000000000000123).toExponential()","\"1.23e-20\"");
shouldBe("Number(.0000000000000000000123).toExponential()","\"1.23e-20\"");
shouldBe("Number(.0000000000000000001234).toExponential()","\"1.234e-19\"");
shouldBe("Number(.0000000000000000012345).toExponential()","\"1.2345e-18\"");
shouldBe("Number(.0000000000000000123456).toExponential()","\"1.23456e-17\"");
shouldBe("Number(.0000000000000001234567).toExponential()","\"1.234567e-16\"");
shouldBe("Number(.0000000000000012345678).toExponential()","\"1.2345678e-15\"");
shouldBe("Number(.0000000000000123456789).toExponential()","\"1.23456789e-14\"");
shouldBe("Number(.0000000000001234567890).toExponential()","\"1.23456789e-13\"");
shouldBe("Number(.0000000000012345678901).toExponential()","\"1.2345678901e-12\"");
shouldBe("Number(.0000000000123456789012).toExponential()","\"1.23456789012e-11\"");
shouldBe("Number(.0000000001234567890123).toExponential()","\"1.234567890123e-10\"");
shouldBe("Number(.0000000012345678901234).toExponential()","\"1.2345678901234e-9\"");
shouldBe("Number(.0000000123456789012345).toExponential()","\"1.23456789012345e-8\"");
shouldBe("Number(.0000001234567890123456).toExponential()","\"1.234567890123456e-7\"");
shouldBe("Number(.0000012345678901234567).toExponential()","\"1.2345678901234567e-6\"");
shouldBe("Number(.0000123456789012345678).toExponential()","\"1.2345678901234568e-5\"");
shouldBe("Number(.0001234567890123456789).toExponential()","\"1.2345678901234567e-4\"");
shouldBe("Number(.0012345678901234567890).toExponential()","\"1.2345678901234567e-3\"");
shouldBe("Number(.0123456789012345678901).toExponential()","\"1.2345678901234568e-2\"");
shouldBe("Number(1.234567890123456789012).toExponential()","\"1.2345678901234567e+0\"");
shouldBe("Number(12.34567890123456789012).toExponential()","\"1.2345678901234567e+1\"");
shouldBe("Number(123.4567890123456789012).toExponential()","\"1.2345678901234568e+2\"");
shouldBe("Number(1234.567890123456789012).toExponential()","\"1.234567890123457e+3\"");
shouldBe("Number(12345.67890123456789012).toExponential()","\"1.2345678901234567e+4\"");
shouldBe("Number(123456.7890123456789012).toExponential()","\"1.2345678901234567e+5\"");
shouldBe("Number(1234567.890123456789012).toExponential()","\"1.2345678901234567e+6\"");
shouldBe("Number(12345678.90123456789012).toExponential()","\"1.2345678901234567e+7\"");
shouldBe("Number(123456789.0123456789012).toExponential()","\"1.2345678901234567e+8\"");
shouldBe("Number(1234567890.123456789012).toExponential()","\"1.2345678901234567e+9\"");
shouldBe("Number(12345678901.23456789012).toExponential()","\"1.2345678901234568e+10\"");
shouldBe("Number(123456789012.3456789012).toExponential()","\"1.2345678901234567e+11\"");
shouldBe("Number(1234567890123.456789012).toExponential()","\"1.2345678901234568e+12\"");
shouldBe("Number(12345678901234.56789012).toExponential()","\"1.2345678901234568e+13\"");
shouldBe("Number(123456789012345.6789012).toExponential()","\"1.2345678901234567e+14\"");
shouldBe("Number(1234567890123456.789012).toExponential()","\"1.2345678901234568e+15\"");
shouldBe("Number(12345678901234567.89012).toExponential()","\"1.2345678901234568e+16\"");
shouldBe("Number(123456789012345678.9012).toExponential()","\"1.2345678901234568e+17\"");
shouldBe("Number(1234567890123456789.012).toExponential()","\"1.2345678901234568e+18\"");
shouldBe("Number(12345678901234567890.12).toExponential()","\"1.2345678901234567e+19\"");
shouldBe("Number(123456789012345678901.2).toExponential()","\"1.2345678901234568e+20\"");
shouldBe("Number(-.0000000000000000000001).toExponential()","\"-1e-22\"");
shouldBe("Number(-.0000000000000000000012).toExponential()","\"-1.2e-21\"");
shouldBe("Number(-.0000000000000000000123).toExponential()","\"-1.23e-20\"");
shouldBe("Number(-.0000000000000000000123).toExponential()","\"-1.23e-20\"");
shouldBe("Number(-.0000000000000000001234).toExponential()","\"-1.234e-19\"");
shouldBe("Number(-.0000000000000000012345).toExponential()","\"-1.2345e-18\"");
shouldBe("Number(-.0000000000000000123456).toExponential()","\"-1.23456e-17\"");
shouldBe("Number(-.0000000000000001234567).toExponential()","\"-1.234567e-16\"");
shouldBe("Number(-.0000000000000012345678).toExponential()","\"-1.2345678e-15\"");
shouldBe("Number(-.0000000000000123456789).toExponential()","\"-1.23456789e-14\"");
shouldBe("Number(-.0000000000001234567890).toExponential()","\"-1.23456789e-13\"");
shouldBe("Number(-.0000000000012345678901).toExponential()","\"-1.2345678901e-12\"");
shouldBe("Number(-.0000000000123456789012).toExponential()","\"-1.23456789012e-11\"");
shouldBe("Number(-.0000000001234567890123).toExponential()","\"-1.234567890123e-10\"");
shouldBe("Number(-.0000000012345678901234).toExponential()","\"-1.2345678901234e-9\"");
shouldBe("Number(-.0000000123456789012345).toExponential()","\"-1.23456789012345e-8\"");
shouldBe("Number(-.0000001234567890123456).toExponential()","\"-1.234567890123456e-7\"");
shouldBe("Number(-.0000012345678901234567).toExponential()","\"-1.2345678901234567e-6\"");
shouldBe("Number(-.0000123456789012345678).toExponential()","\"-1.2345678901234568e-5\"");
shouldBe("Number(-.0001234567890123456789).toExponential()","\"-1.2345678901234567e-4\"");
shouldBe("Number(-.0012345678901234567890).toExponential()","\"-1.2345678901234567e-3\"");
shouldBe("Number(-.0123456789012345678901).toExponential()","\"-1.2345678901234568e-2\"");
shouldBe("Number(-1.234567890123456789012).toExponential()","\"-1.2345678901234567e+0\"");
shouldBe("Number(-12.34567890123456789012).toExponential()","\"-1.2345678901234567e+1\"");
shouldBe("Number(-123.4567890123456789012).toExponential()","\"-1.2345678901234568e+2\"");
shouldBe("Number(-1234.567890123456789012).toExponential()","\"-1.234567890123457e+3\"");
shouldBe("Number(-12345.67890123456789012).toExponential()","\"-1.2345678901234567e+4\"");
shouldBe("Number(-123456.7890123456789012).toExponential()","\"-1.2345678901234567e+5\"");
shouldBe("Number(-1234567.890123456789012).toExponential()","\"-1.2345678901234567e+6\"");
shouldBe("Number(-12345678.90123456789012).toExponential()","\"-1.2345678901234567e+7\"");
shouldBe("Number(-123456789.0123456789012).toExponential()","\"-1.2345678901234567e+8\"");
shouldBe("Number(-1234567890.123456789012).toExponential()","\"-1.2345678901234567e+9\"");
shouldBe("Number(-12345678901.23456789012).toExponential()","\"-1.2345678901234568e+10\"");
shouldBe("Number(-123456789012.3456789012).toExponential()","\"-1.2345678901234567e+11\"");
shouldBe("Number(-1234567890123.456789012).toExponential()","\"-1.2345678901234568e+12\"");
shouldBe("Number(-12345678901234.56789012).toExponential()","\"-1.2345678901234568e+13\"");
shouldBe("Number(-123456789012345.6789012).toExponential()","\"-1.2345678901234567e+14\"");
shouldBe("Number(-1234567890123456.789012).toExponential()","\"-1.2345678901234568e+15\"");
shouldBe("Number(-12345678901234567.89012).toExponential()","\"-1.2345678901234568e+16\"");
shouldBe("Number(-123456789012345678.9012).toExponential()","\"-1.2345678901234568e+17\"");
shouldBe("Number(-1234567890123456789.012).toExponential()","\"-1.2345678901234568e+18\"");
shouldBe("Number(-12345678901234567890.12).toExponential()","\"-1.2345678901234567e+19\"");
shouldBe("Number(-123456789012345678901.2).toExponential()","\"-1.2345678901234568e+20\"");
shouldBeTrue("try { Number(1).toPrecision(-1); } catch (e) { String(e).indexOf('Range') >= 0; }");
shouldBeTrue("try { Number(1).toPrecision(0); } catch (e) { String(e).indexOf('Range') >= 0; }");
shouldBe("try { Number(1).toPrecision(1); } catch (e) { String(e); }","\"1\"");
shouldBe("try { Number(1).toPrecision(21); } catch (e) { String(e); }","\"1.00000000000000000000\"");
shouldBeTrue("try { Number(1).toPrecision(22); } catch (e) { String(e).indexOf('Range') >= 0; }");
shouldBe("Number(NaN).toPrecision()","\"NaN\"");
shouldBe("Number(NaN).toPrecision(1)","\"NaN\"");
shouldBe("Number(Infinity).toPrecision()","\"Infinity\"");
shouldBe("Number(Infinity).toPrecision(1)","\"Infinity\"");
shouldBe("Number(-Infinity).toPrecision()","\"-Infinity\"");
shouldBe("Number(-Infinity).toPrecision(1)","\"-Infinity\"");
shouldBe("Number(.0000000012345).toPrecision(2)","\"1.2e-9\"");
shouldBe("Number(.000000012345).toPrecision(2)","\"1.2e-8\"");
shouldBe("Number(.00000012345).toPrecision(2)","\"1.2e-7\"");
shouldBe("Number(.0000012345).toPrecision(2)","\"0.0000012\"");
shouldBe("Number(.000012345).toPrecision(2)","\"0.000012\"");
shouldBe("Number(.00012345).toPrecision(2)","\"0.00012\"");
shouldBe("Number(.0012345).toPrecision(2)","\"0.0012\"");
shouldBe("Number(.012345).toPrecision(2)","\"0.012\"");
shouldBe("Number(.12345).toPrecision(2)","\"0.12\"");
shouldBe("Number(1.2345).toPrecision(2)","\"1.2\"");
shouldBe("Number(12.345).toPrecision(2)","\"12\"");
shouldBe("Number(123.45).toPrecision(2)","\"1.2e+2\"");
shouldBe("Number(1234.5).toPrecision(2)","\"1.2e+3\"");
shouldBe("Number(12345).toPrecision(2)","\"1.2e+4\"");
shouldBe("Number(12345.67).toPrecision(4)","\"1.235e+4\"");
shouldBe("Number(12344.67).toPrecision(4)","\"1.234e+4\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision()","\"0.00012345678901234567\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(1)","\"0.0001\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(2)","\"0.00012\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(3)","\"0.000123\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(4)","\"0.0001235\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(5)","\"0.00012346\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(6)","\"0.000123457\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(7)","\"0.0001234568\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(8)","\"0.00012345679\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(9)","\"0.000123456789\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(10)","\"0.0001234567890\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(11)","\"0.00012345678901\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(12)","\"0.000123456789012\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(13)","\"0.0001234567890123\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(14)","\"0.00012345678901235\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(15)","\"0.000123456789012346\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(16)","\"0.0001234567890123457\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(17)","\"0.00012345678901234567\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(18)","\"0.000123456789012345671\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(19)","\"0.0001234567890123456713\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(20)","\"0.00012345678901234567130\"");
shouldBe("Number(0.0001234567890123456789012345).toPrecision(21)","\"0.000123456789012345671298\"");
shouldBe("Number(12345.67890123456789012345).toPrecision()","\"12345.678901234567\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(1)","\"1e+4\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(2)","\"1.2e+4\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(3)","\"1.23e+4\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(4)","\"1.235e+4\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(5)","\"12346\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(6)","\"12345.7\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(7)","\"12345.68\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(8)","\"12345.679\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(9)","\"12345.6789\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(10)","\"12345.67890\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(11)","\"12345.678901\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(12)","\"12345.6789012\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(13)","\"12345.67890123\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(14)","\"12345.678901235\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(15)","\"12345.6789012346\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(16)","\"12345.67890123457\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(17)","\"12345.678901234567\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(18)","\"12345.6789012345671\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(19)","\"12345.67890123456709\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(20)","\"12345.678901234567093\"");
shouldBe("Number(12345.67890123456789012345).toPrecision(21)","\"12345.6789012345670926\"");
shouldBe("Number(-.0000000012345).toPrecision(2)","\"-1.2e-9\"");
shouldBe("Number(-.000000012345).toPrecision(2)","\"-1.2e-8\"");
shouldBe("Number(-.00000012345).toPrecision(2)","\"-1.2e-7\"");
shouldBe("Number(-.0000012345).toPrecision(2)","\"-0.0000012\"");
shouldBe("Number(-.000012345).toPrecision(2)","\"-0.000012\"");
shouldBe("Number(-.00012345).toPrecision(2)","\"-0.00012\"");
shouldBe("Number(-.0012345).toPrecision(2)","\"-0.0012\"");
shouldBe("Number(-.012345).toPrecision(2)","\"-0.012\"");
shouldBe("Number(-.12345).toPrecision(2)","\"-0.12\"");
shouldBe("Number(-1.2345).toPrecision(2)","\"-1.2\"");
shouldBe("Number(-12.345).toPrecision(2)","\"-12\"");
shouldBe("Number(-123.45).toPrecision(2)","\"-1.2e+2\"");
shouldBe("Number(-1234.5).toPrecision(2)","\"-1.2e+3\"");
shouldBe("Number(-12345).toPrecision(2)","\"-1.2e+4\"");
shouldBe("Number(-12345.67).toPrecision(4)","\"-1.235e+4\"");
shouldBe("Number(-12344.67).toPrecision(4)","\"-1.234e+4\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision()","\"-0.00012345678901234567\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(1)","\"-0.0001\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(2)","\"-0.00012\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(3)","\"-0.000123\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(4)","\"-0.0001235\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(5)","\"-0.00012346\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(6)","\"-0.000123457\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(7)","\"-0.0001234568\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(8)","\"-0.00012345679\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(9)","\"-0.000123456789\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(10)","\"-0.0001234567890\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(11)","\"-0.00012345678901\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(12)","\"-0.000123456789012\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(13)","\"-0.0001234567890123\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(14)","\"-0.00012345678901235\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(15)","\"-0.000123456789012346\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(16)","\"-0.0001234567890123457\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(17)","\"-0.00012345678901234567\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(18)","\"-0.000123456789012345671\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(19)","\"-0.0001234567890123456713\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(20)","\"-0.00012345678901234567130\"");
shouldBe("Number(-0.0001234567890123456789012345).toPrecision(21)","\"-0.000123456789012345671298\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision()","\"-12345.678901234567\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(1)","\"-1e+4\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(2)","\"-1.2e+4\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(3)","\"-1.23e+4\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(4)","\"-1.235e+4\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(5)","\"-12346\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(6)","\"-12345.7\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(7)","\"-12345.68\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(8)","\"-12345.679\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(9)","\"-12345.6789\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(10)","\"-12345.67890\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(11)","\"-12345.678901\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(12)","\"-12345.6789012\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(13)","\"-12345.67890123\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(14)","\"-12345.678901235\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(15)","\"-12345.6789012346\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(16)","\"-12345.67890123457\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(17)","\"-12345.678901234567\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(18)","\"-12345.6789012345671\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(19)","\"-12345.67890123456709\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(20)","\"-12345.678901234567093\"");
shouldBe("Number(-12345.67890123456789012345).toPrecision(21)","\"-12345.6789012345670926\"");
shouldBe("Number(0).toPrecision()","\"0\"");
shouldBe("Number(0).toPrecision(1)","\"0\"");
shouldBe("Number(0).toPrecision(2)","\"0.0\"");
shouldBe("Number(0).toPrecision(3)","\"0.00\"");
shouldBe("Number(0).toPrecision(4)","\"0.000\"");
shouldBe("Number(0).toPrecision(5)","\"0.0000\"");
shouldBe("Number(0).toPrecision(6)","\"0.00000\"");
shouldBe("Number(0).toPrecision(7)","\"0.000000\"");
shouldBe("Number(0).toPrecision(8)","\"0.0000000\"");
shouldBe("Number(0).toPrecision(9)","\"0.00000000\"");
shouldBe("Number(0).toPrecision(10)","\"0.000000000\"");
shouldBe("Number(0).toPrecision(11)","\"0.0000000000\"");
shouldBe("Number(0).toPrecision(12)","\"0.00000000000\"");
shouldBe("Number(0).toPrecision(13)","\"0.000000000000\"");
shouldBe("Number(0).toPrecision(14)","\"0.0000000000000\"");
shouldBe("Number(0).toPrecision(15)","\"0.00000000000000\"");
shouldBe("Number(0).toPrecision(16)","\"0.000000000000000\"");
shouldBe("Number(0).toPrecision(17)","\"0.0000000000000000\"");
shouldBe("Number(0).toPrecision(18)","\"0.00000000000000000\"");
shouldBe("Number(0).toPrecision(19)","\"0.000000000000000000\"");
shouldBe("Number(0).toPrecision(20)","\"0.0000000000000000000\"");
shouldBe("Number(0).toPrecision(21)","\"0.00000000000000000000\"");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS typeof Object() is 'object'
PASS var o = Object(); o.x = 11; o.x; is 11
PASS Object(1).valueOf() is 1
PASS Object(true).valueOf() is true
PASS Object('s').valueOf() is 's'
PASS typeof (new Object()) is 'object'
PASS (new Object(1)).valueOf() is 1
PASS (new Object(true)).valueOf() is true
PASS (new Object('s')).valueOf() is 's'
PASS String(Object()) is '[object Object]'
PASS Object().toString() is '[object Object]'
PASS String(Object().valueOf()) is '[object Object]'
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
shouldBe("typeof Object()", "'object'");
shouldBe("var o = Object(); o.x = 11; o.x;", "11"); // wanted behaviour ?
// shouldBe("Object(undefined)", ???);
// shouldBe("Object(null)", ???);
shouldBe("Object(1).valueOf()", "1");
shouldBe("Object(true).valueOf()", "true");
shouldBe("Object('s').valueOf()", "'s'");
shouldBe("typeof (new Object())", "'object'");
// shouldBe("new Object(undefined)", ???);
// shouldBe("new Object(null)", ???);
shouldBe("(new Object(1)).valueOf()", "1");
shouldBe("(new Object(true)).valueOf()", "true");
shouldBe("(new Object('s')).valueOf()", "'s'");
shouldBe("String(Object())", "'[object Object]'");
shouldBe("Object().toString()", "'[object Object]'");
shouldBe("String(Object().valueOf())", "'[object Object]'");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS s.area() is 9
PASS b.name is 'a book'
PASS b.author is 'Fred'
PASS delete Boolean.prototype is false
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
///////////////////////////////////////////////////////
function Square(x)
{
this.x = x;
}
new Square(0); // create prototype
function Square_area() { return this.x * this.x; }
Square.prototype.area = Square_area;
var s = new Square(3);
shouldBe("s.area()", "9");
///////////////////////////////////////////////////////
function Item(name){
this.name = name;
}
function Book(name, author){
this.base = Item; // set Item constructor as method of Book object
this.base(name); // set the value of name property
this.author = author;
}
Book.prototype = new Item;
var b = new Book("a book", "Fred"); // create object instance
//edebug(e"b.name"));
shouldBe("b.name", "'a book'");
shouldBe("b.author", "'Fred'"); // outpus "Fred"
///////////////////////////////////////////////////////
shouldBe("delete Boolean.prototype", "false");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS (new RegExp()).source is '(?:)'
PASS Boolean(new RegExp()) is true
PASS isNaN(Number(new RegExp())) is true
PASS RegExp(/x/).source is 'x'
PASS RegExp('x', 'g').global is true
PASS RegExp('x').source is 'x'
PASS new RegExp('x').source is 'x'
PASS (/a/).global is false
PASS typeof (/a/).global is 'boolean'
PASS rg.global is true
PASS (/a/).ignoreCase is false
PASS ri.ignoreCase is true
PASS (/a/).multiline is false
PASS rm.multiline is true
PASS rg.toString() is '/a/g'
PASS ri.toString() is '/a/i'
PASS rm.toString() is '/a/m'
PASS rg.global is true
PASS ri.ignoreCase is true
PASS rm.multiline is true
PASS Boolean(/a/.test) is true
PASS /(b)c/.exec('abcd').toString() is "bc,b"
PASS /(b)c/.exec('abcd').length is 2
PASS /(b)c/.exec('abcd').index is 1
PASS /(b)c/.exec('abcd').input is 'abcd'
PASS rs.source is 'foo'
PASS var r = new RegExp(/x/); r.global=true; r.lastIndex = -1; typeof r.test('a') is 'boolean'
PASS 'abcdefghi'.match(/(abc)def(ghi)/).toString() is 'abcdefghi,abc,ghi'
PASS /(abc)def(ghi)/.exec('abcdefghi').toString() is 'abcdefghi,abc,ghi'
PASS RegExp.$1 is 'abc'
PASS RegExp.$2 is 'ghi'
PASS RegExp.$3 is ''
PASS 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/).toString() is 'abcdefghi,abcdefghi,bcdefgh,cdefg,def,e'
PASS RegExp.$1 is 'abcdefghi'
PASS RegExp.$2 is 'bcdefgh'
PASS RegExp.$3 is 'cdefg'
PASS RegExp.$4 is 'def'
PASS RegExp.$5 is 'e'
PASS RegExp.$6 is ''
PASS '(100px 200px 150px 15px)'.match(/\((\d+)(px)* (\d+)(px)* (\d+)(px)* (\d+)(px)*\)/).toString() is '(100px 200px 150px 15px),100,px,200,px,150,px,15,px'
PASS RegExp.$1 is '100'
PASS RegExp.$3 is '200'
PASS RegExp.$5 is '150'
PASS RegExp.$7 is '15'
PASS ''.match(/((\d+)(px)* (\d+)(px)* (\d+)(px)* (\d+)(px)*)/) is null
PASS RegExp.$1 is '100'
PASS RegExp.$3 is '200'
PASS RegExp.$5 is '150'
PASS RegExp.$7 is '15'
PASS 'faure@kde.org'.match(invalidChars) == null is true
PASS 'faure-kde@kde.org'.match(invalidChars) == null is false
PASS 'test1test2'.replace('test','X') is 'X1test2'
PASS 'test1test2'.replace(/\d/,'X') is 'testXtest2'
PASS '1test2test3'.replace(/\d/,'') is 'test2test3'
PASS 'test1test2'.replace(/test/g,'X') is 'X1X2'
PASS '1test2test3'.replace(/\d/g,'') is 'testtest'
PASS '1test2test3'.replace(/x/g,'') is '1test2test3'
PASS 'test1test2'.replace(/(te)(st)/g,'$2$1') is 'stte1stte2'
PASS 'foo+bar'.replace(/\+/g,'%2B') is 'foo%2Bbar'
PASS caught is true
PASS 'foo'.replace(/z?/g,'x') is 'xfxoxox'
PASS 'test test'.replace(/\s*/g,'') is 'testtest'
PASS 'abc$%@'.replace(/[^0-9a-z]*/gi,'') is 'abc'
PASS 'ab'.replace(/[^\d\.]*/gi,'') is ''
PASS '1ab'.replace(/[^\d\.]*/gi,'') is '1'
PASS '1test2test3blah'.split(/test/).toString() is '1,2,3blah'
PASS reg.exec(str).toString() is '98 ,98 '
PASS reg.lastIndex is 3
PASS RegExp.$1 is '98 '
PASS RegExp.$2 is ''
PASS reg.exec(str).toString() is '76 ,76 '
PASS reg.lastIndex is 6
PASS RegExp.$1 is '76 '
PASS RegExp.$2 is ''
PASS reg.exec(str) is null
PASS reg.lastIndex is 0
PASS myRe=/d(b+)d/g; myArray = myRe.exec('cdbbdbsbz'); myRe.lastIndex is 5
PASS reg.ignoreCase == true is true
PASS reg.global === false is true
PASS reg.multiline === false is true
PASS reg.test('UGO') is true
PASS reg.x = 1; reg.x is 1
PASS var r2 = reg; r2.x = 2; reg.x is 2
PASS str.match(re).toString() is 'Chapter 3.4.5.1,Chapter 3.4.5.1,.1'
PASS str.match(/d/gi).toString() is 'D,d'
PASS /\u0061/.source is '\\u0061'
PASS 'abc'.match(/\u0062/).toString() is 'b'
PASS Object.prototype.toString.apply(RegExp.prototype) is '[object RegExp]'
PASS typeof RegExp.prototype.toString() is 'string'
PASS new RegExp().toString() is '/(?:)/'
PASS (new RegExp('(?:)')).source is '(?:)'
PASS /(?:)/.toString() is '/(?:)/'
PASS /(?:)/.source is '(?:)'
Done.
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
shouldBe("(new RegExp()).source", "'(?:)'");
shouldBe("Boolean(new RegExp())", "true");
shouldBeTrue("isNaN(Number(new RegExp()))");
// RegExp constructor called as a function
shouldBe("RegExp(/x/).source", "'x'");
//shouldBe("RegExp(/x/, 'g').source", "'/x/'"); // can't supply flags when constructing one RegExp from another, says mozilla
shouldBe("RegExp('x', 'g').global", "true");
shouldBe("RegExp('x').source", "'x'");
// RegExp constructor
shouldBe("new RegExp('x').source", "'x'");
var ri = /a/i;
var rm = /a/m;
var rg = /a/g;
shouldBeFalse("(/a/).global");
shouldBe("typeof (/a/).global", "'boolean'");
shouldBeTrue("rg.global");
shouldBeFalse("(/a/).ignoreCase");
shouldBeTrue("ri.ignoreCase");
shouldBeFalse("(/a/).multiline");
shouldBeTrue("rm.multiline");
shouldBe("rg.toString()", "'/a/g'");
shouldBe("ri.toString()", "'/a/i'");
shouldBe("rm.toString()", "'/a/m'");
// check properety attributes
rg.global = false;
shouldBeTrue("rg.global");
ri.ignoreCase = false;
shouldBeTrue("ri.ignoreCase");
rm.multiline = false;
shouldBeTrue("rm.multiline");
shouldBe("Boolean(/a/.test)", "true");
shouldBe("/(b)c/.exec('abcd').toString()", "\"bc,b\"");
shouldBe("/(b)c/.exec('abcd').length", "2");
shouldBe("/(b)c/.exec('abcd').index", "1");
shouldBe("/(b)c/.exec('abcd').input", "'abcd'");
var rs = /foo/;
rs.source = "bar";
shouldBe("rs.source", "'foo'");
shouldBe("var r = new RegExp(/x/); r.global=true; r.lastIndex = -1; typeof r.test('a')", "'boolean'");
shouldBe("'abcdefghi'.match(/(abc)def(ghi)/).toString()","'abcdefghi,abc,ghi'");
shouldBe("/(abc)def(ghi)/.exec('abcdefghi').toString()","'abcdefghi,abc,ghi'");
shouldBe("RegExp.$1","'abc'");
shouldBe("RegExp.$2","'ghi'");
shouldBe("RegExp.$3","''");
shouldBe("'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/).toString()", "'abcdefghi,abcdefghi,bcdefgh,cdefg,def,e'");
shouldBe("RegExp.$1","'abcdefghi'");
shouldBe("RegExp.$2","'bcdefgh'");
shouldBe("RegExp.$3","'cdefg'");
shouldBe("RegExp.$4","'def'");
shouldBe("RegExp.$5","'e'");
shouldBe("RegExp.$6","''");
shouldBe("'(100px 200px 150px 15px)'.match(/\\((\\d+)(px)* (\\d+)(px)* (\\d+)(px)* (\\d+)(px)*\\)/).toString()","'(100px 200px 150px 15px),100,px,200,px,150,px,15,px'");
shouldBe("RegExp.$1","'100'");
shouldBe("RegExp.$3","'200'");
shouldBe("RegExp.$5","'150'");
shouldBe("RegExp.$7","'15'");
shouldBe("''.match(/\((\\d+)(px)* (\\d+)(px)* (\\d+)(px)* (\\d+)(px)*\)/)","null");
// After a failed match, cached results on the RegExp object are unchanged.
shouldBe("RegExp.$1","'100'");
shouldBe("RegExp.$3","'200'");
shouldBe("RegExp.$5","'150'");
shouldBe("RegExp.$7","'15'");
var invalidChars = /[^@\.\w]/g; // #47092
shouldBe("'faure@kde.org'.match(invalidChars) == null", "true");
shouldBe("'faure-kde@kde.org'.match(invalidChars) == null", "false");
shouldBe("'test1test2'.replace('test','X')","'X1test2'");
shouldBe("'test1test2'.replace(/\\d/,'X')","'testXtest2'");
shouldBe("'1test2test3'.replace(/\\d/,'')","'test2test3'");
shouldBe("'test1test2'.replace(/test/g,'X')","'X1X2'");
shouldBe("'1test2test3'.replace(/\\d/g,'')","'testtest'");
shouldBe("'1test2test3'.replace(/x/g,'')","'1test2test3'");
shouldBe("'test1test2'.replace(/(te)(st)/g,'$2$1')","'stte1stte2'");
shouldBe("'foo+bar'.replace(/\\+/g,'%2B')", "'foo%2Bbar'");
var caught = false; try { new RegExp("+"); } catch (e) { caught = true; }
shouldBeTrue("caught"); // #40435
shouldBe("'foo'.replace(/z?/g,'x')", "'xfxoxox'");
shouldBe("'test test'.replace(/\\s*/g,'')","'testtest'"); // #50985
shouldBe("'abc$%@'.replace(/[^0-9a-z]*/gi,'')","'abc'"); // #50848
shouldBe("'ab'.replace(/[^\\d\\.]*/gi,'')","''"); // #75292
shouldBe("'1ab'.replace(/[^\\d\\.]*/gi,'')","'1'"); // #75292
shouldBe("'1test2test3blah'.split(/test/).toString()","'1,2,3blah'");
var reg = /(\d\d )/g;
var str = new String('98 76 blah');
shouldBe("reg.exec(str).toString()","'98 ,98 '");
shouldBe("reg.lastIndex","3");
shouldBe("RegExp.$1","'98 '");
shouldBe("RegExp.$2","''");
shouldBe("reg.exec(str).toString()","'76 ,76 '");
shouldBe("reg.lastIndex","6");
shouldBe("RegExp.$1","'76 '");
shouldBe("RegExp.$2","''");
shouldBe("reg.exec(str)","null");
shouldBe("reg.lastIndex","0");
// http://www.devguru.com/Technologies/ecmascript/quickref/regexp_lastindex.html
// Looks IE-only though
//shouldBe( "var re=/ships*\s/; re.exec('the hardships of traveling'); re.lastIndex", "14" );
//shouldBe( "var re=/ships*\s/; str='the hardships of traveling'; re.exec(str); re.exec(str); re.lastIndex", "0" );
// http://devedge.netscape.com/library/manuals/2000/javascript/1.5/guide/regexp.html
shouldBe( "myRe=/d(b+)d/g; myArray = myRe.exec('cdbbdbsbz'); myRe.lastIndex", "5" );
reg = /^u/i;
shouldBeTrue("reg.ignoreCase == true");
shouldBeTrue("reg.global === false");
shouldBeTrue("reg.multiline === false");
shouldBeTrue("reg.test('UGO')");
// regexp are writable ?
shouldBe("reg.x = 1; reg.x", "1");
// shared data ?
shouldBe("var r2 = reg; r2.x = 2; reg.x", "2");
var str = new String("For more information, see Chapter 3.4.5.1");
re = /(chapter \d+(\.\d)*)/i;
// This returns the array containing Chapter 3.4.5.1,Chapter 3.4.5.1,.1
// 'Chapter 3.4.5.1' is the first match and the first value remembered from (Chapter \d+(\.\d)*).
// '.1' is the second value remembered from (\.\d)
shouldBe("str.match(re).toString()","'Chapter 3.4.5.1,Chapter 3.4.5.1,.1'");
str = "abcDdcba";
// The returned array contains D, d.
shouldBe("str.match(/d/gi).toString()","'D,d'");
// unicode escape sequence
shouldBe("/\\u0061/.source", "'\\\\u0061'");
shouldBe("'abc'.match(/\\u0062/).toString()", "'b'");
shouldBe("Object.prototype.toString.apply(RegExp.prototype)",
        "'[object RegExp]'");
// not sure what this should return. most importantly
// it doesn't throw an exception
shouldBe("typeof RegExp.prototype.toString()", "'string'");
// Empty regular expressions have string representation /(?:)/
shouldBe("new RegExp().toString()", "'/(?:)/'");
shouldBe("(new RegExp('(?:)')).source", "'(?:)'");
shouldBe("/(?:)/.toString()", "'/(?:)/'");
shouldBe("/(?:)/.source", "'(?:)'");
debug("Done.");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS test0
PASS test1
PASS test2
PASS test3
PASS test4.(1)
PASS test4.(2)
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
// We can't use normal shouldBe here, since they'd eval in the wrong context...
function shouldBeOfType(msg, val, type) {
if (typeof(val) != type)
testFailed(msg + ": value has type " + typeof(val) + " , not:" + type);
else
testPassed(msg);
}
function test0() {
var arguments;
// var execution should not overwrite something that was
// in scope beforehand -- e.g. the arguments thing
shouldBeOfType("test0", arguments, 'object');
}
function test1() {
// No need to undef-initialize something in scope already!
shouldBeOfType("test1", arguments, 'object');
var arguments;
}
function test2(arguments) {
// Formals OTOH can overwrite the args object
shouldBeOfType("test2", arguments, 'number');
}
function test3() {
// Ditto for functions..
shouldBeOfType("test3", arguments, 'function');
function arguments() {}
}
function test4() {
// Here, the -declaration- part of the var below should have no
// effect..
shouldBeOfType('test4.(1)', arguments, 'object');
var arguments = 4;
// .. but the assignment shoud just happen
shouldBeOfType('test4.(2)', arguments, 'number');
}
test0();
test1();
test2(42);
test3();
test4();
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS var i = 1; i is 1
PASS j = k = 2 is 2
PASS var i; i is undefined.
PASS var i = 1; i <<= 2 is 4
PASS var i = 8; i >>= 1 is 4
PASS var i = 1; i >>= 2 is 0
PASS var i = -8; i >>= 24 is -1
PASS var i = 8; i >>>= 2 is 2
PASS var i = -8; i >>>= 24 is 255
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
// simple assignment
shouldBe("var i = 1; i", "1");
shouldBe("j = k = 2", "2");
shouldBeUndefined("var i; i");
// compound assignments
shouldBe("var i = 1; i <<= 2", "4");
shouldBe("var i = 8; i >>= 1", "4");
shouldBe("var i = 1; i >>= 2", "0");
shouldBe("var i = -8; i >>= 24", "-1");
shouldBe("var i = 8; i >>>= 2", "2");
shouldBe("var i = -8; i >>>= 24", "255");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Boolean(1) === true is true
PASS var s = String; s(1) === '1' is true
PASS n = Number; n(true) === 1 is true
PASS String(Array('a', 'b' )) is 'a,b'
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
shouldBeTrue("Boolean(1) === true");
shouldBeTrue("var s = String; s(1) === '1'");
shouldBeTrue("n = Number; n(true) === 1");
shouldBe("String(Array('a', 'b'        ))", "'a,b'");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
// comment with linebreak
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
// comment with linebreak
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS foo(), i is 2
PASS caught is true
PASS val is 11
PASS val is 12
PASS val is 13
PASS val is 14
PASS val is 15
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
var i = 1;
function foo() {
i = 2;
return;
i = 3;
}
shouldBe("foo(), i", "2");
var caught = false;
try { eval("return;"); } catch(e) { caught = true; }
shouldBeTrue("caught");
// value completions take precedence
var val = eval("11; { }");
shouldBe("val", "11");
val = eval("12; ;");
shouldBe("val", "12");
val = eval("13; if(false);");
shouldBe("val", "13");
val = eval("14; function f() {}");
shouldBe("val", "14");
val = eval("15; var v = 0");
shouldBe("val", "15");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS true ? 1 : 2 is 1
PASS false ? 1 : 2 is 2
PASS 'abc' ? 1 : 2 is 1
PASS null ? 1 : 2 is 2
PASS undefined ? 1 : 2 is 2
PASS /*var a=1;if (undefined) a = 2;*/ a is 1
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
shouldBe("true ? 1 : 2", "1");
shouldBe("false ? 1 : 2", "2");
shouldBe("'abc' ? 1 : 2", "1");
shouldBe("null ? 1 : 2", "2");
shouldBe("undefined ? 1 : 2", "2");
var a = 1;
if ( undefined )
a = 2;
shouldBe("/*var a=1;if (undefined) a = 2;*/ a", "1");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Object.length is 1
PASS Function.length is 1
PASS Array.length is 1
PASS String.length is 1
PASS Boolean.length is 1
PASS Number.length is 1
PASS Date.length is 7
PASS RegExp.length is 2
PASS Error.length is 1
PASS EvalError.length is 1
PASS RangeError.length is 1
PASS ReferenceError.length is 1
PASS SyntaxError.length is 1
PASS TypeError.length is 1
PASS URIError.length is 1
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
shouldBe("Object.length","1");
shouldBe("Function.length","1");
shouldBe("Array.length","1");
shouldBe("String.length","1");
shouldBe("Boolean.length","1");
shouldBe("Number.length","1");
shouldBe("Date.length","7");
shouldBe("RegExp.length","2");
shouldBe("Error.length","1");
shouldBe("EvalError.length","1");
shouldBe("RangeError.length","1");
shouldBe("ReferenceError.length","1");
shouldBe("SyntaxError.length","1");
shouldBe("TypeError.length","1");
shouldBe("URIError.length","1");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
// infinite recursion
try {
var v = [];
v[0] = v;
v.toString();
} catch (e) {
debug("OK. Caught an exception.");
}
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
OK. Caught an exception
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
// infinite recursion 2
function foo() {
foo();
}
try {
foo();
} catch (e) {
debug("OK. Caught an exception");
}
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS a = 1; delete a; is true
PASS delete nonexistant; is true
PASS delete NaN is false
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
shouldBe("a = 1; delete a;", "true");
shouldBe("delete nonexistant;", "true");
shouldBe("delete NaN", "false");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
// --------------------------------------------------------------------------------
var resolution = 251; // set to 1 for 100% coverage
function checkEncodeException(encodeFunctionName,c1,c2)
{
if (c2 == undefined)
shouldThrow(encodeFunctionName
+ "(String.fromCharCode(" + c1 + "))");
else
shouldThrow(encodeFunctionName
+ "(String.fromCharCode(" + c1 + ") + String.fromCharCode(" + c2 + "))");
}
function checkEncodeDecode(encodeFunctionName, decodeFunctionName, c1, c2)
{
if (c2 == undefined)
shouldBe(decodeFunctionName + "(" + encodeFunctionName
+ "(String.fromCharCode(" + c1 + ")))",
"String.fromCharCode(" + c1 + ")");
else
shouldBe(decodeFunctionName + "(" + encodeFunctionName
+ "(String.fromCharCode(" + c1 + ") + String.fromCharCode(" + c2 + ")))",
"String.fromCharCode(" + c1 + ") + String.fromCharCode(" + c2 + ")");
}
function checkWithFunctions(encodeFunction, decodeFunction)
{
checkEncodeDecode(encodeFunction, decodeFunction, 0);
checkEncodeDecode(encodeFunction, decodeFunction, 0xD7FF);
checkEncodeDecode(encodeFunction, decodeFunction, 0xE000);
checkEncodeDecode(encodeFunction, decodeFunction, 0xFFFD);
checkEncodeDecode(encodeFunction, decodeFunction, 0xFFFE);
checkEncodeDecode(encodeFunction, decodeFunction, 0xFFFF);
checkEncodeException(encodeFunction, 0xDC00);
checkEncodeException(encodeFunction, 0xDFFF);
checkEncodeDecode(encodeFunction, decodeFunction, 0xD800, 0xDC00);
checkEncodeDecode(encodeFunction, decodeFunction, 0xDBFF, 0xDC00);
checkEncodeDecode(encodeFunction, decodeFunction, 0xD800, 0xDFFF);
checkEncodeDecode(encodeFunction, decodeFunction, 0xDBFF, 0xDFFF);
checkEncodeException(encodeFunction, 0xD800, 0);
checkEncodeException(encodeFunction, 0xD800, 0xD7FF);
checkEncodeException(encodeFunction, 0xD800, 0xD800);
checkEncodeException(encodeFunction, 0xD800, 0xDBFF);
checkEncodeException(encodeFunction, 0xD800, 0xE000);
checkEncodeException(encodeFunction, 0xD800, 0xE000);
checkEncodeException(encodeFunction, 0xD800, 0xFFFD);
checkEncodeException(encodeFunction, 0xD800, 0xFFFE);
checkEncodeException(encodeFunction, 0xD800, 0xFFFF);
for (var charcode = 1; charcode < 0xD7FF; charcode += resolution)
checkEncodeDecode(encodeFunction, decodeFunction, charcode);
for (var charcode = 0xE001; charcode < 0xFFFD; charcode += resolution)
checkEncodeDecode(encodeFunction, decodeFunction, charcode);
for (var charcode = 0xDC01; charcode < 0xDFFF; charcode += resolution)
checkEncodeException(encodeFunction, charcode);
for (var charcode = 0xD801; charcode < 0xDBFF; charcode += resolution)
checkEncodeDecode(encodeFunction, decodeFunction, charcode, 0xDC00);
for (var charcode = 0xDC01; charcode < 0xDFFF; charcode += resolution)
checkEncodeDecode(encodeFunction, decodeFunction, 0xD800, charcode);
for (var charcode = 1; charcode < 0xDBFF; charcode += resolution)
checkEncodeException(encodeFunction, 0xD800, charcode);
for (var charcode = 0xE001; charcode < 0xFFFD; charcode += resolution)
checkEncodeException(encodeFunction, 0xD800, charcode);
}
checkWithFunctions("encodeURI", "decodeURI");
checkWithFunctions("encodeURIComponent", "decodeURIComponent");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS eval.length is 1
PASS eval('this') is this
PASS bx is 99
PASS cx is 99
PASS Skipping test for deprecated Object.prototype.eval()
PASS lotto() is 0
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
shouldBe("eval.length", "1");
shouldBe("eval('this')", "this");
function MyObject() {
this.x = 99;
}
eval("b = new MyObject();");
var bx = b.x // rule out side effects of eval() in shouldBe() test function
shouldBe("bx", "99");
eval("var c = new MyObject();"); // the 'var' makes a difference
var cx = c.x;
shouldBe("cx", "99");
// KDE bug #45679
if (true.eval) {
var o = { str:1 };
shouldBe("o.eval('str')", "1");
shouldBe("o.eval('this')", "this");
} else {
testPassed("Skipping test for deprecated Object.prototype.eval()");
}
// problem from within khtml
function lotto() {
// j must be accessible to eval()
for (var j = 0; j < 1; j++)
return eval('j');
}
shouldBe("lotto()", "0");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS (new Error()).message is ''
PASS ''.split(/.*/).length is 0
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
shouldBe("(new Error()).message", "''");
// the empty match isn't taken in account
shouldBe("''.split(/.*/).length", "0");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS func_ret_with_ex_func is 4
PASS func_ret_from_ex_throw_args is 4
PASS set_from_throw_func_args is 4
PASS set_from_func_throw_args is 4
PASS set_from_before_func_throw_args is 1
PASS function_param_order is 'abc'
PASS new_param_order is 'abc'
PASS elision_param_order is 'abc'
PASS comma_order is 'abc'
PASS OpEqEq_part1 is 1
PASS OpEqEq_part2 is 4
PASS OpNotEq_part1 is 1
PASS OpNotEq_part2 is 4
PASS OpStrEq_part1 is 1
PASS OpStrEq_part2 is 4
PASS OpStrNEq_part1 is 1
PASS OpStrNEq_part2 is 4
PASS OpLess_part1 is 1
PASS OpLess_part2 is 4
PASS OpLessEq_part1 is 1
PASS OpLessEq_part2 is 4
PASS OpGreater_part1 is 1
PASS OpGreater_part2 is 4
PASS OpGreaterEq_part1 is 1
PASS OpGreaterEq_part2 is 4
PASS OpAnd_part1 is 1
PASS OpAnd_part2 is 4
PASS OpOr_part1 is 1
PASS OpOr_part2 is 4
PASS OpBitAnd_part1 is 1
PASS OpBitAnd_part2 is 4
PASS OpBitXOr_part1 is 1
PASS OpBitXOr_part2 is 4
PASS OpBitOr_part1 is 1
PASS OpBitOr_part2 is 4
PASS OpLShift_part1 is 1
PASS OpLShift_part2 is 4
PASS OpRShift_part1 is 1
PASS OpRShift_part2 is 4
PASS OpURShift_part1 is 1
PASS OpURShift_part2 is 4
PASS OpInstanceOf_part1 is 1
PASS OpInstanceOf_part2 is 4
PASS set_from_if_stmt is 4
PASS set_from_if_else_stmt is 4
PASS set_from_else_in_if_else_stmt is 4
PASS comma_left is 1
PASS comma_left is 4
PASS vardecl_assign_throws is 4
PASS var_assign_before_throw_run is true
PASS var_assign_after_throw_run is false
PASS do_val is 5
PASS while_val is 4
PASS for_val_part1_throw2 is 1
PASS for_val_part1_throw3 is 1
PASS for_val_part2_throw1 is 4
PASS for_val_part2_throw3 is 1
PASS for_val_part3_throw1 is 4
PASS for_val_part3_throw2 is 4
PASS for_val_part1_throwbody is 1
PASS for_val_part2_throwbody is 1
PASS for_val_part3_throwbody is 4
PASS forin_count is 4
PASS set_inside_with_throw is 4
PASS set_inside_with_cantconverttoobject is 4
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
var global = this;
function myfunc() {
}
function throwex() {
throw new Error("test exception");
}
//---------------------------
var func_ret_with_ex_func = 4;
try {
func_ret_with_ex_func = throwex()();
}
catch (e) {
}
shouldBe("func_ret_with_ex_func", "4");
// ---------------------------------
var func_ret_from_ex_throw_args = 4;
try {
func_ret_from_ex_throw_args = Math.abs(throwex());
}
catch (e) {
}
shouldBe("func_ret_from_ex_throw_args", "4");
// ---------------------------------
var set_from_throw_func_args = 4;
try {
throwex()(set_from_throw_func_args = 1);
}
catch (e) {
}
shouldBe("set_from_throw_func_args","4");
// ---------------------------------
var set_from_func_throw_args = 4;
try {
myfunc(throwex(), set_from_func_throw_args = 1);
}
catch (e) {
}
shouldBe("set_from_func_throw_args","4");
// ---------------------------------
var set_from_before_func_throw_args = 4;
try {
myfunc(set_from_before_func_throw_args = 1, throwex());
}
catch (e) {
}
shouldBe("set_from_before_func_throw_args","1");
// ---------------------------------
// ### move to function.js
var function_param_order = "";
function aparam() {
function_param_order += "a";
}
function bparam() {
function_param_order += "b";
}
function cparam() {
function_param_order += "c";
}
myfunc(aparam(),bparam(),cparam());
shouldBe("function_param_order","'abc'");
// ---------------------------------
// ### move to function.js
var new_param_order = "";
function anewparam() {
new_param_order += "a";
}
function bnewparam() {
new_param_order += "b";
}
function cnewparam() {
new_param_order += "c";
}
new myfunc(anewparam(),bnewparam(),cnewparam());
shouldBe("new_param_order","'abc'");
// ---------------------------------
// ### move to function.js
var elision_param_order = "";
function aelision() {
elision_param_order += "a";
}
function belision() {
elision_param_order += "b";
}
function celision() {
elision_param_order += "c";
}
[aelision(),belision(),celision()];
shouldBe("elision_param_order","'abc'");
// ---------------------------------
// ### move to function.js
var comma_order = "";
function acomma() {
comma_order += "a";
}
function bcomma() {
comma_order += "b";
}
function ccomma() {
comma_order += "c";
}
acomma(),bcomma(),ccomma();
shouldBe("comma_order","'abc'");
// ---------------------------------
function checkOperator(op,name) {
var code =(
"global."+name+"_part1 = 4;\n"+
"try {\n"+
" ("+name+"_part1 = 1) "+op+" throwex();\n"+
"}\n"+
"catch (e) {\n"+
"}\n"+
"shouldBe('"+name+"_part1', '1');\n"+
"global."+name+"_part2 = 4;\n"+
"try {\n"+
" throwex() "+op+" ("+name+"_part2 = 1);\n"+
"}\n"+
"catch (e) {\n"+
"}\n"+
"shouldBe('"+name+"_part2', '4');\n");
// print("\n\n\n");
// print(code);
eval(code);
}
checkOperator("==","OpEqEq");
checkOperator("!=","OpNotEq");
checkOperator("===","OpStrEq");
checkOperator("!==","OpStrNEq");
// ### these generate a syntax error in mozilla - kjs should do the same (?)
//checkOperator("+=","OpPlusEq");
//checkOperator("-=","OpMinusEq");
//checkOperator("*=","OpMultEq");
//checkOperator("/=","OpDivEq");
// OpPlusPlus,
//                 OpMinusMinus,
checkOperator("<","OpLess");
checkOperator("<=","OpLessEq");
checkOperator(">","OpGreater");
checkOperator(">=","OpGreaterEq");
//checkOperator("&=","OpAndEq");
//checkOperator("^=","OpXOrEq");
//checkOperator("|=","OpOrEq");
//checkOperator("%=","OpModEq");
checkOperator("&&","OpAnd");
checkOperator("||","OpOr");
checkOperator("&","OpBitAnd");
checkOperator("^","OpBitXOr");
checkOperator("|","OpBitOr");
checkOperator("<<","OpLShift");
checkOperator(">>","OpRShift");
checkOperator(">>>","OpURShift");
//                 OpIn,
checkOperator("instanceof","OpInstanceOf");
// ---------------------------------
var set_from_if_stmt = 4;
try {
if (throwex()) {
set_from_if_stmt = 1;
}
}
catch (e) {
}
shouldBe("set_from_if_stmt","4");
// ---------------------------------
var set_from_if_else_stmt = 4;
try {
if (throwex()) {
set_from_if_else_stmt = 1;
}
else {
undefined;
}
}
catch (e) {
}
shouldBe("set_from_if_else_stmt","4");
// ---------------------------------
var set_from_else_in_if_else_stmt = 4;
try {
if (throwex()) {
undefined;
}
else {
set_from_else_in_if_else_stmt = 1;
}
}
catch (e) {
}
shouldBe("set_from_else_in_if_else_stmt","4");
// ---------------------------------
var comma_left = 4;
try {
comma_left = 1, throwex();
}
catch (e) {
}
shouldBe("comma_left","1");
// ---------------------------------
var comma_left = 4;
try {
throwex(), comma_left = 1;
}
catch (e) {
}
shouldBe("comma_left","4");
var vardecl_assign_throws = 4;
try {
var vardecl_assign_throws = throwex();
}
catch (e) {
}
shouldBe("vardecl_assign_throws","4");
// ---------------------------------
var var_assign_before_throw_run = false;
function var_assign_before_throw() {
var_assign_before_throw_run = true;
return 1;
}
var var_assign_after_throw_run = false;
function var_assign_after_throw() {
var_assign_after_throw_run = true;
return 1;
}
try {
var var_assign1 = var_assign_before_throw(),
var_assign2 = throwex(),
var_assign1 = var_assign_before_throw();
}
catch (e) {
}
shouldBe("var_assign_before_throw_run","true");
shouldBe("var_assign_after_throw_run","false");
// ---------------------------------
var do_val = 4;
try {
do {
do_val++;
}
while (throwex());
}
catch (e) {
}
shouldBe("do_val","5");
// ---------------------------------
var while_val = 4;
try {
while (throwex()) {
while_val++;
}
}
catch (e) {
}
shouldBe("while_val","4");
// ---------------------------------
var for_val_part1_throw2 = 4;
try {
for (for_val_part1_throw2 = 1; throwex(); ) {
}
}
catch (e) {
}
shouldBe("for_val_part1_throw2","1");
// ---------------------------------
var for_val_part1_throw3 = 4;
try {
for (for_val_part1_throw3 = 1; ; throwex()) {
}
}
catch (e) {
}
shouldBe("for_val_part1_throw3","1");
// ---------------------------------
var for_val_part2_throw1 = 4;
try {
for (throwex(); for_val_part2_throw1 = 1; ) {
}
}
catch (e) {
}
shouldBe("for_val_part2_throw1","4");
// ---------------------------------
var for_val_part2_throw3 = 4;
try {
for (; for_val_part2_throw3 = 1; throwex()) {
}
}
catch (e) {
}
shouldBe("for_val_part2_throw3","1");
// ---------------------------------
var for_val_part3_throw1 = 4;
try {
for (throwex(); ; for_val_part3_throw1 = 1) {
}
}
catch (e) {
}
shouldBe("for_val_part3_throw1","4");
// ---------------------------------
var for_val_part3_throw2 = 4;
try {
for (; throwex(); for_val_part3_throw2 = 1) {
}
}
catch (e) {
}
shouldBe("for_val_part3_throw2","4");
// ---------------------------------
var for_val_part1_throwbody = 4;
try {
for (for_val_part1_throwbody = 1; ;) {
throwex();
}
}
catch (e) {
}
shouldBe("for_val_part1_throwbody","1");
// ---------------------------------
var for_val_part2_throwbody = 4;
try {
for (; for_val_part2_throwbody = 1; ) {
throwex();
}
}
catch (e) {
}
shouldBe("for_val_part2_throwbody","1");
// ---------------------------------
var for_val_part3_throwbody = 4;
try {
for (; ; for_val_part3_throwbody = 1) {
throwex();
}
}
catch (e) {
}
shouldBe("for_val_part3_throwbody","4");
// ---------------------------------
var forin_test_obj = new Object();
forin_test_obj.a = 1;
forin_test_obj.b = 2;
forin_test_obj.c = 3;
var forin_count = 4;
function forin_lexpr() {
// if (forincount == 1);
// throwex();
return new Object();
}
try {
for (throwex() in forin_test_obj) {
forin_count++;
}
}
catch (e) {
}
shouldBe("forin_count","4");
// ---------------------------------
var set_inside_with_throw = 4;
try {
with (throwex()) {
set_inside_with_throw = 1;
}
}
catch (e) {
}
shouldBe("set_inside_with_throw","4");
// ---------------------------------
var set_inside_with_cantconverttoobject = 4;
try {
with (undefined) {
print("FAIL. This message should not be displayed");
set_inside_with_cantconverttoobject = 1;
}
}
catch (e) {
}
shouldBe("set_inside_with_cantconverttoobject","4");
// ### test case, sw
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Except a lot of errors. They should all be caught and lead to PASS
testing throw() .......... Passed
testing throw() .......... Passed
ReferenceError .......... Passed
error propagation in functions .......... Passed
catch
finally
Math() error .......... Passed
Abort while() on error .......... Passed
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
function kdeShouldBe(a, b, c)
{
if ( a == b )
debug(c+" .......... Passed");
else
debug(c+" .......... Failed");
}
function testThrow()
{
var caught = false;
try {
throw 99;
} catch (e) {
caught = true;
}
kdeShouldBe(caught, true, "testing throw()");
}
// same as above but lacking a semicolon after throw
function testThrow2()
{
var caught = false;
try {
throw 99
} catch (e) {
caught = true;
}
kdeShouldBe(caught, true, "testing throw()");
}
function testReferenceError()
{
var err = "noerror";
var caught = false;
try {
var dummy = nonexistant; // throws reference error
} catch (e) {
caught = true;
err = e.name;
}
// test err
kdeShouldBe(caught, true, "ReferenceError");
}
function testFunctionErrorHelper()
{
var a = b; // throws reference error
}
function testFunctionError()
{
var caught = false;
try {
testFunctionErrorHelper();
} catch (e) {
caught = true;
}
kdeShouldBe(caught, true, "error propagation in functions");
}
function testMathFunctionError()
{
var caught = false;
try {
Math();
} catch (e) {
debug("catch");
caught = true;
} finally {
debug("finally");
}
kdeShouldBe(caught, true, "Math() error");
}
function testWhileAbortion()
{
var caught = 0;
try {
while (a=b, 1) {        // "endless error" in condition
;
}
} catch (e) {
caught++;
}
try {
while (1) {
var a = b;        // error in body
}
} catch (e) {
caught++;
}
kdeShouldBe(caught, 2, "Abort while() on error");
}
debug("Except a lot of errors. They should all be caught and lead to PASS");
testThrow();
testThrow2();
testReferenceError();
testFunctionError();
testMathFunctionError();
testWhileAbortion();
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Function declaration takes effect at entry
PASS Decl not yet overwritten
PASS After assign (0)
PASS function decls have no execution content
PASS After assign #2 (0)
PASS Decl already overwritten
PASS After assign (1)
PASS function decls have no execution content
PASS After assign #2 (1)
PASS Decl already overwritten
PASS After assign (2)
PASS function decls have no execution content
PASS After assign #2 (2)
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
// We can't use normal shouldBe here, since they'd eval in the wrong context...
function shouldBeOfType(msg, val, type) {
if (typeof(val) != type)
testFailed(msg + ": value has type " + typeof(val) + " , not:" + type);
else
testPassed(msg);
}
function shouldBeVal(msg, val, expected) {
if (val != expected)
testFailed(msg + ": value is " + val + " , not:" + expected);
else
testPassed(msg);
}
f = "global";
function test() {
try {
shouldBeOfType("Function declaration takes effect at entry", f, "function");
}
catch (e) {
testFailed("Scoping very broken!");
}
for (var i = 0; i < 3; ++i) {
if (i == 0)
shouldBeOfType("Decl not yet overwritten", f, 'function');
else
shouldBeOfType("Decl already overwritten", f, 'number');
f = 3;
shouldBeVal("After assign ("+i+")", f, 3);
function f() {};
shouldBeVal("function decls have no execution content", f, 3);
f = 5;
shouldBeVal("After assign #2 ("+i+")", f, 5);
}
}
test();
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Object.prototype.toString.__proto__ is Function.prototype
PASS Object.prototype.valueOf.__proto__ is Function.prototype
PASS Array.prototype.toString.__proto__ is Function.prototype
PASS Array.prototype.toLocaleString.__proto__ is Function.prototype
PASS Array.prototype.concat.__proto__ is Function.prototype
PASS Array.prototype.join.__proto__ is Function.prototype
PASS Array.prototype.pop.__proto__ is Function.prototype
PASS Array.prototype.push.__proto__ is Function.prototype
PASS Array.prototype.reverse.__proto__ is Function.prototype
PASS Array.prototype.shift.__proto__ is Function.prototype
PASS Array.prototype.slice.__proto__ is Function.prototype
PASS Array.prototype.sort.__proto__ is Function.prototype
PASS Array.prototype.splice.__proto__ is Function.prototype
PASS Array.prototype.unshift.__proto__ is Function.prototype
PASS String.prototype.toString.__proto__ is Function.prototype
PASS String.prototype.valueOf.__proto__ is Function.prototype
PASS String.prototype.charAt.__proto__ is Function.prototype
PASS String.prototype.charCodeAt.__proto__ is Function.prototype
PASS String.prototype.indexOf.__proto__ is Function.prototype
PASS String.prototype.lastIndexOf.__proto__ is Function.prototype
PASS String.prototype.match.__proto__ is Function.prototype
PASS String.prototype.replace.__proto__ is Function.prototype
PASS String.prototype.search.__proto__ is Function.prototype
PASS String.prototype.slice.__proto__ is Function.prototype
PASS String.prototype.split.__proto__ is Function.prototype
PASS String.prototype.substr.__proto__ is Function.prototype
PASS String.prototype.substring.__proto__ is Function.prototype
PASS String.prototype.toLowerCase.__proto__ is Function.prototype
PASS String.prototype.toUpperCase.__proto__ is Function.prototype
PASS String.prototype.big.__proto__ is Function.prototype
PASS String.prototype.small.__proto__ is Function.prototype
PASS String.prototype.blink.__proto__ is Function.prototype
PASS String.prototype.bold.__proto__ is Function.prototype
PASS String.prototype.fixed.__proto__ is Function.prototype
PASS String.prototype.italics.__proto__ is Function.prototype
PASS String.prototype.strike.__proto__ is Function.prototype
PASS String.prototype.sub.__proto__ is Function.prototype
PASS String.prototype.sup.__proto__ is Function.prototype
PASS String.prototype.fontcolor.__proto__ is Function.prototype
PASS String.prototype.fontsize.__proto__ is Function.prototype
PASS String.prototype.anchor.__proto__ is Function.prototype
PASS String.prototype.link.__proto__ is Function.prototype
PASS Boolean.prototype.toString.__proto__ is Function.prototype
PASS Boolean.prototype.valueOf.__proto__ is Function.prototype
PASS Date.prototype.toString.__proto__ is Function.prototype
PASS Date.prototype.toUTCString.__proto__ is Function.prototype
PASS Date.prototype.toDateString.__proto__ is Function.prototype
PASS Date.prototype.toTimeString.__proto__ is Function.prototype
PASS Date.prototype.toLocaleString.__proto__ is Function.prototype
PASS Date.prototype.toLocaleDateString.__proto__ is Function.prototype
PASS Date.prototype.toLocaleTimeString.__proto__ is Function.prototype
PASS Date.prototype.valueOf.__proto__ is Function.prototype
PASS Date.prototype.getTime.__proto__ is Function.prototype
PASS Date.prototype.getFullYear.__proto__ is Function.prototype
PASS Date.prototype.getUTCFullYear.__proto__ is Function.prototype
PASS Date.prototype.toGMTString.__proto__ is Function.prototype
PASS Date.prototype.getMonth.__proto__ is Function.prototype
PASS Date.prototype.getUTCMonth.__proto__ is Function.prototype
PASS Date.prototype.getDate.__proto__ is Function.prototype
PASS Date.prototype.getUTCDate.__proto__ is Function.prototype
PASS Date.prototype.getDay.__proto__ is Function.prototype
PASS Date.prototype.getUTCDay.__proto__ is Function.prototype
PASS Date.prototype.getHours.__proto__ is Function.prototype
PASS Date.prototype.getUTCHours.__proto__ is Function.prototype
PASS Date.prototype.getMinutes.__proto__ is Function.prototype
PASS Date.prototype.getUTCMinutes.__proto__ is Function.prototype
PASS Date.prototype.getSeconds.__proto__ is Function.prototype
PASS Date.prototype.getUTCSeconds.__proto__ is Function.prototype
PASS Date.prototype.getMilliseconds.__proto__ is Function.prototype
PASS Date.prototype.getUTCMilliseconds.__proto__ is Function.prototype
PASS Date.prototype.getTimezoneOffset.__proto__ is Function.prototype
PASS Date.prototype.setTime.__proto__ is Function.prototype
PASS Date.prototype.setMilliseconds.__proto__ is Function.prototype
PASS Date.prototype.setUTCMilliseconds.__proto__ is Function.prototype
PASS Date.prototype.setSeconds.__proto__ is Function.prototype
PASS Date.prototype.setUTCSeconds.__proto__ is Function.prototype
PASS Date.prototype.setMinutes.__proto__ is Function.prototype
PASS Date.prototype.setUTCMinutes.__proto__ is Function.prototype
PASS Date.prototype.setHours.__proto__ is Function.prototype
PASS Date.prototype.setUTCHours.__proto__ is Function.prototype
PASS Date.prototype.setDate.__proto__ is Function.prototype
PASS Date.prototype.setUTCDate.__proto__ is Function.prototype
PASS Date.prototype.setMonth.__proto__ is Function.prototype
PASS Date.prototype.setUTCMonth.__proto__ is Function.prototype
PASS Date.prototype.setFullYear.__proto__ is Function.prototype
PASS Date.prototype.setUTCFullYear.__proto__ is Function.prototype
PASS Date.prototype.setYear.__proto__ is Function.prototype
PASS Date.prototype.getYear.__proto__ is Function.prototype
PASS Date.prototype.toGMTString.__proto__ is Function.prototype
PASS RegExp.prototype.exec.__proto__ is Function.prototype
PASS RegExp.prototype.test.__proto__ is Function.prototype
PASS RegExp.prototype.toString.__proto__ is Function.prototype
PASS Error.prototype.toString.__proto__ is Function.prototype
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
shouldBe("Object.prototype.toString.__proto__","Function.prototype");
shouldBe("Object.prototype.valueOf.__proto__","Function.prototype");
shouldBe("Array.prototype.toString.__proto__","Function.prototype");
shouldBe("Array.prototype.toLocaleString.__proto__","Function.prototype");
shouldBe("Array.prototype.concat.__proto__","Function.prototype");
shouldBe("Array.prototype.join.__proto__","Function.prototype");
shouldBe("Array.prototype.pop.__proto__","Function.prototype");
shouldBe("Array.prototype.push.__proto__","Function.prototype");
shouldBe("Array.prototype.reverse.__proto__","Function.prototype");
shouldBe("Array.prototype.shift.__proto__","Function.prototype");
shouldBe("Array.prototype.slice.__proto__","Function.prototype");
shouldBe("Array.prototype.sort.__proto__","Function.prototype");
shouldBe("Array.prototype.splice.__proto__","Function.prototype");
shouldBe("Array.prototype.unshift.__proto__","Function.prototype");
shouldBe("String.prototype.toString.__proto__","Function.prototype");
shouldBe("String.prototype.valueOf.__proto__","Function.prototype");
shouldBe("String.prototype.charAt.__proto__","Function.prototype");
shouldBe("String.prototype.charCodeAt.__proto__","Function.prototype");
shouldBe("String.prototype.indexOf.__proto__","Function.prototype");
shouldBe("String.prototype.lastIndexOf.__proto__","Function.prototype");
shouldBe("String.prototype.match.__proto__","Function.prototype");
shouldBe("String.prototype.replace.__proto__","Function.prototype");
shouldBe("String.prototype.search.__proto__","Function.prototype");
shouldBe("String.prototype.slice.__proto__","Function.prototype");
shouldBe("String.prototype.split.__proto__","Function.prototype");
shouldBe("String.prototype.substr.__proto__","Function.prototype");
shouldBe("String.prototype.substring.__proto__","Function.prototype");
shouldBe("String.prototype.toLowerCase.__proto__","Function.prototype");
shouldBe("String.prototype.toUpperCase.__proto__","Function.prototype");
shouldBe("String.prototype.big.__proto__","Function.prototype");
shouldBe("String.prototype.small.__proto__","Function.prototype");
shouldBe("String.prototype.blink.__proto__","Function.prototype");
shouldBe("String.prototype.bold.__proto__","Function.prototype");
shouldBe("String.prototype.fixed.__proto__","Function.prototype");
shouldBe("String.prototype.italics.__proto__","Function.prototype");
shouldBe("String.prototype.strike.__proto__","Function.prototype");
shouldBe("String.prototype.sub.__proto__","Function.prototype");
shouldBe("String.prototype.sup.__proto__","Function.prototype");
shouldBe("String.prototype.fontcolor.__proto__","Function.prototype");
shouldBe("String.prototype.fontsize.__proto__","Function.prototype");
shouldBe("String.prototype.anchor.__proto__","Function.prototype");
shouldBe("String.prototype.link.__proto__","Function.prototype");
shouldBe("Boolean.prototype.toString.__proto__","Function.prototype");
shouldBe("Boolean.prototype.valueOf.__proto__","Function.prototype");
shouldBe("Date.prototype.toString.__proto__","Function.prototype");
shouldBe("Date.prototype.toUTCString.__proto__","Function.prototype");
shouldBe("Date.prototype.toDateString.__proto__","Function.prototype");
shouldBe("Date.prototype.toTimeString.__proto__","Function.prototype");
shouldBe("Date.prototype.toLocaleString.__proto__","Function.prototype");
shouldBe("Date.prototype.toLocaleDateString.__proto__","Function.prototype");
shouldBe("Date.prototype.toLocaleTimeString.__proto__","Function.prototype");
shouldBe("Date.prototype.valueOf.__proto__","Function.prototype");
shouldBe("Date.prototype.getTime.__proto__","Function.prototype");
shouldBe("Date.prototype.getFullYear.__proto__","Function.prototype");
shouldBe("Date.prototype.getUTCFullYear.__proto__","Function.prototype");
shouldBe("Date.prototype.toGMTString.__proto__","Function.prototype");
shouldBe("Date.prototype.getMonth.__proto__","Function.prototype");
shouldBe("Date.prototype.getUTCMonth.__proto__","Function.prototype");
shouldBe("Date.prototype.getDate.__proto__","Function.prototype");
shouldBe("Date.prototype.getUTCDate.__proto__","Function.prototype");
shouldBe("Date.prototype.getDay.__proto__","Function.prototype");
shouldBe("Date.prototype.getUTCDay.__proto__","Function.prototype");
shouldBe("Date.prototype.getHours.__proto__","Function.prototype");
shouldBe("Date.prototype.getUTCHours.__proto__","Function.prototype");
shouldBe("Date.prototype.getMinutes.__proto__","Function.prototype");
shouldBe("Date.prototype.getUTCMinutes.__proto__","Function.prototype");
shouldBe("Date.prototype.getSeconds.__proto__","Function.prototype");
shouldBe("Date.prototype.getUTCSeconds.__proto__","Function.prototype");
shouldBe("Date.prototype.getMilliseconds.__proto__","Function.prototype");
shouldBe("Date.prototype.getUTCMilliseconds.__proto__","Function.prototype");
shouldBe("Date.prototype.getTimezoneOffset.__proto__","Function.prototype");
shouldBe("Date.prototype.setTime.__proto__","Function.prototype");
shouldBe("Date.prototype.setMilliseconds.__proto__","Function.prototype");
shouldBe("Date.prototype.setUTCMilliseconds.__proto__","Function.prototype");
shouldBe("Date.prototype.setSeconds.__proto__","Function.prototype");
shouldBe("Date.prototype.setUTCSeconds.__proto__","Function.prototype");
shouldBe("Date.prototype.setMinutes.__proto__","Function.prototype");
shouldBe("Date.prototype.setUTCMinutes.__proto__","Function.prototype");
shouldBe("Date.prototype.setHours.__proto__","Function.prototype");
shouldBe("Date.prototype.setUTCHours.__proto__","Function.prototype");
shouldBe("Date.prototype.setDate.__proto__","Function.prototype");
shouldBe("Date.prototype.setUTCDate.__proto__","Function.prototype");
shouldBe("Date.prototype.setMonth.__proto__","Function.prototype");
shouldBe("Date.prototype.setUTCMonth.__proto__","Function.prototype");
shouldBe("Date.prototype.setFullYear.__proto__","Function.prototype");
shouldBe("Date.prototype.setUTCFullYear.__proto__","Function.prototype");
shouldBe("Date.prototype.setYear.__proto__","Function.prototype");
shouldBe("Date.prototype.getYear.__proto__","Function.prototype");
shouldBe("Date.prototype.toGMTString.__proto__","Function.prototype");
shouldBe("RegExp.prototype.exec.__proto__","Function.prototype");
shouldBe("RegExp.prototype.test.__proto__","Function.prototype");
shouldBe("RegExp.prototype.toString.__proto__","Function.prototype");
shouldBe("Error.prototype.toString.__proto__","Function.prototype");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS count is 10
PASS count is 5
PASS count is 10
PASS properties is 'a=11;b=22;'
PASS list is '[0]=100;[1]=101;'
PASS list is '123'
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
// 12.6.1
var count = 0;
do {
count++;
} while (count < 10);
shouldBe("count", "10");
count = 0;
for (var i = 0; i < 10; i++) {
if (i == 5)
break;
count++;
}
shouldBe("count", "5");
// 12.6.3
count = 0;
for (i = 0; i < 10; i++) {
count++;
}
shouldBe("count", "10");
// 12.6.4
obj = new Object();
obj.a = 11;
obj.b = 22;
properties = "";
for ( prop in obj )
properties += (prop + "=" + obj[prop] + ";");
shouldBe("properties", "'a=11;b=22;'");
// now a test verifying the order. not standardized but common.
obj.y = 33;
obj.x = 44;
properties = "";
for ( prop in obj )
properties += prop;
// shouldBe("properties", "'abyx'");
arr = new Array;
arr[0] = 100;
arr[1] = 101;
list = "";
for ( var j in arr ) {
list += "[" + j + "]=" + arr[j] + ";";
}
shouldBe("list","'[0]=100;[1]=101;'");
list = "";
for (var a = [1,2,3], length = a.length, i = 0; i < length; i++) {
list += a[i];
}
shouldBe("list", "'123'");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
<!-- HTML comment (not ECMA)
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
--> end of HTML comment (not ECMA)
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS x is 1
PASS 0x0 is 0
PASS 0xF is 15
PASS 0xFF is 255
PASS 01 is 1
PASS 010 is 8
PASS 09 is 9
PASS 019 is 19
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
var x = 0;
eval("\u0009 \u000B \u000C \u00A0x = 1;");
shouldBe("x", "1");
// hex (non-normative)
shouldBe("0x0", "0");
shouldBe("0xF", "15");
shouldBe("0xFF", "255");
// octal (non-normative)
shouldBe("01", "1");
shouldBe("010", "8");
shouldBe("09", "9");
shouldBe("019", "19");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS function () { a = x; } threw exception ReferenceError: x is not defined.
PASS function () { x += "foo"; } threw exception ReferenceError: x is not defined.
PASS function () { b = a.x; } did not throw an exception
PASS function () { b = a['x']; } did not throw an exception
PASS function () { a['x'] += 'baz'; } did not throw an exception
PASS a['x'] is "undefinedbaz"
PASS function () { b = a.y; } did not throw an exception
PASS function () { a.y += 'glarch'; } did not throw an exception
PASS a['y'] is "undefinedglarch"
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
// Tests for raising --- and non-raising exceptions on access to reference to undefined things...
// Locals should throw on access if undefined..
fnShouldThrow(function() { a = x; }, ReferenceError);
// Read-modify-write versions of assignment should throw as well
fnShouldThrow(function() { x += "foo"; }, ReferenceError);
// Other reference types should just return undefined...
a = new Object();
fnShouldNotThrow(function() { b = a.x; });
fnShouldNotThrow(function() { b = a['x']; });
fnShouldNotThrow(function() { a['x'] += 'baz'; });
shouldBe("a['x']", '"undefinedbaz"');
fnShouldNotThrow(function() { b = a.y; });
fnShouldNotThrow(function() { a.y += 'glarch'; });
shouldBe("a['y']", '"undefinedglarch"');
// Helpers!
function fnShouldThrow(f, exType)
{
var exception;
var _av;
try {
_av = f();
} catch (e) {
exception = e;
}
if (exception) {
if (typeof exType == "undefined" || exception instanceof exType)
testPassed(f + " threw exception " + exception + ".");
else
testFailed(f + " should throw exception " + exType + ". Threw exception " + exception + ".");
} else if (typeof _av == "undefined")
testFailed(f + " should throw exception " + exType + ". Was undefined.");
else
testFailed(f + " should throw exception " + exType + ". Was " + _av + ".");
}
function fnShouldNotThrow(f)
{
try {
f();
testPassed(f + " did not throw an exception");
} catch (e) {
testFailed(f + " threw an exception " + e + " when no exception expected");
}
}
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS isNegativeZero(negativeZero) is true
PASS isNegativeZero(0) is false
PASS String()+Math.E is '2.718281828459045'
PASS String()+Math.LN2 is '0.6931471805599453'
PASS String()+Math.LN10 is '2.302585092994046'
PASS String()+Math.LOG2E is '1.4426950408889634'
PASS String()+Math.LOG10E is '0.4342944819032518'
PASS String()+Math.PI is '3.141592653589793'
PASS String()+Math.SQRT1_2 is '0.7071067811865476'
PASS String()+Math.SQRT2 is '1.4142135623730951'
PASS String()+Number.NaN is 'NaN'
PASS String()+Number.NEGATIVE_INFINITY is '-Infinity'
PASS String()+Number.POSITIVE_INFINITY is 'Infinity'
PASS Math.abs(-5) is 5
PASS Math.acos(0) is Math.PI/2
PASS Math.acos(1) is 0
PASS Math.ceil(1.1) is 2
PASS String()+Math.sqrt(2) is String()+Math.SQRT2
PASS Math.ceil(1.6) is 2
PASS Math.round(0) is 0
PASS isNegativeZero(Math.round(0)) is false
PASS isNegativeZero(Math.round(negativeZero)) is true
PASS Math.round(0.2) is 0
PASS isNegativeZero(Math.round(-0.2)) is true
PASS isNegativeZero(Math.round(-0.5)) is true
PASS Math.round(1.1) is 1
PASS Math.round(1.6) is 2
PASS Math.round(-3.5) is -3
PASS Math.round(-3.6) is -4
PASS isNaN(Math.round()) is true
PASS isNaN(Math.round(NaN)) is true
PASS Math.round(-Infinity) is -Infinity
PASS Math.round(Infinity) is Infinity
PASS Math.round(99999999999999999999.99) is 100000000000000000000
PASS Math.round(-99999999999999999999.99) is -100000000000000000000
PASS Math.log(Math.E*Math.E) is 2
PASS isNaN(Math.log(NaN)) is true
PASS isNaN(Math.log(-1)) is true
PASS isFinite(Math.log(0)) is false
PASS Math.log(1) is 0
PASS isFinite(Math.log(Infinity)) is false
PASS isNegativeZero(Math.min(negativeZero, 0)) is true
PASS isFinite(Math.max()) is false
PASS Math.max(1) is 1
PASS Math.max(1, 2, 3) is 3
PASS isNaN(Math.max(1,NaN,3)) is true
PASS !isNegativeZero(Math.max(negativeZero, 0)) is true
PASS list is ''
PASS delete my.v is true
PASS my.v is undefined.
PASS delete Math.PI is false
PASS my = myfunc, myfunc(4) is 5
PASS Boolean(Math) is true
PASS isNaN(Number(Math)); is true
PASS Math.abs===Math.abs is true
PASS Math.abs===Math.round is false
PASS list is 'a,b,'
PASS list is ''
PASS list is 'myprop,'
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
var negativeZero = Math.atan2(-1, Infinity); // ### any nicer way?
function isNegativeZero(n)
{
return n == 0 && 1 / n < 0;
}
// self tests
shouldBeTrue("isNegativeZero(negativeZero)");
shouldBeFalse("isNegativeZero(0)");
// Constants
shouldBe("String()+Math.E", "'2.718281828459045'");
shouldBe("String()+Math.LN2", "'0.6931471805599453'");
shouldBe("String()+Math.LN10", "'2.302585092994046'");
shouldBe("String()+Math.LOG2E", "'1.4426950408889634'");
shouldBe("String()+Math.LOG10E", "'0.4342944819032518'");
shouldBe("String()+Math.PI", "'3.141592653589793'");
shouldBe("String()+Math.SQRT1_2", "'0.7071067811865476'");
shouldBe("String()+Math.SQRT2", "'1.4142135623730951'");
shouldBe("String()+Number.NaN", "'NaN'");
shouldBe("String()+Number.NEGATIVE_INFINITY", "'-Infinity'");
shouldBe("String()+Number.POSITIVE_INFINITY", "'Infinity'");
// Functions
shouldBe("Math.abs(-5)", "5");
shouldBe("Math.acos(0)", "Math.PI/2");
shouldBe("Math.acos(1)", "0");
shouldBe("Math.ceil(1.1)", "2");
shouldBe("String()+Math.sqrt(2)", "String()+Math.SQRT2");
shouldBe("Math.ceil(1.6)", "2");
shouldBe("Math.round(0)", "0");
shouldBeFalse("isNegativeZero(Math.round(0))");
shouldBeTrue("isNegativeZero(Math.round(negativeZero))");
shouldBe("Math.round(0.2)", "0");
shouldBeTrue("isNegativeZero(Math.round(-0.2))");
shouldBeTrue("isNegativeZero(Math.round(-0.5))");
shouldBe("Math.round(1.1)", "1");
shouldBe("Math.round(1.6)", "2");
shouldBe("Math.round(-3.5)", "-3");
shouldBe("Math.round(-3.6)", "-4");
shouldBeTrue("isNaN(Math.round())");
shouldBeTrue("isNaN(Math.round(NaN))");
shouldBe("Math.round(-Infinity)", "-Infinity");
shouldBe("Math.round(Infinity)", "Infinity");
shouldBe("Math.round(99999999999999999999.99)", "100000000000000000000");
shouldBe("Math.round(-99999999999999999999.99)", "-100000000000000000000");
// Math.log()
shouldBe("Math.log(Math.E*Math.E)", "2");
shouldBeTrue("isNaN(Math.log(NaN))");
shouldBeTrue("isNaN(Math.log(-1))");
shouldBeFalse("isFinite(Math.log(0))");
shouldBe("Math.log(1)", "0");
shouldBeFalse("isFinite(Math.log(Infinity))");
// Math.min()
shouldBeTrue("isNegativeZero(Math.min(negativeZero, 0))");
// Math.max()
shouldBeFalse("isFinite(Math.max())");
shouldBe("Math.max(1)", "1"); // NS 4.x and IE 5.x seem to know about 2 arg version only
shouldBe("Math.max(1, 2, 3)", "3"); // NS 4.x and IE 5.x seem to know about 2 arg version only
shouldBeTrue("isNaN(Math.max(1,NaN,3))");
shouldBeTrue("!isNegativeZero(Math.max(negativeZero, 0))");
list=""
for ( var i in Math ) { list += i + ','; }
shouldBe("list","''");
var my = new Object;
my.v = 1;
// Deleting/assigning
shouldBe("delete my.v", "true")
shouldBeUndefined("my.v");
shouldBe("delete Math.PI", "false")
function myfunc( num ) { return num+1; }
shouldBe("my = myfunc, myfunc(4)", "5");
// Conversions
shouldBe("Boolean(Math)", "true");
shouldBeTrue("isNaN(Number(Math));");
// Unicity
shouldBe("Math.abs===Math.abs", "true")
shouldBe("Math.abs===Math.round", "false")
// Iteration
obj = new Object;
obj.a = 1;
obj.b = 2;
list=""
for ( var i in obj ) { list += i + ','; }
shouldBe("list","'a,b,'");
// (check that Math's properties and functions are not enumerable)
list=""
for ( var i in Math ) { list += i + ','; }
shouldBe("list","''");
Math.myprop=true; // adding a custom property to the math object (why not?)
list=""
for ( var i in Math ) { list += i + ','; }
shouldBe("list","'myprop,'");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS MD5('kde') is '186cf28b76f2264e9fea8fcf91cb4f5d'
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
// shouldBe() (base.js) test at very end of this file (Harri)
/*
* md5.jvs 1.0b 27/06/96
*
* Javascript implementation of the RSA Data Security, Inc. MD5
* Message-Digest Algorithm.
*
* Copyright (c) 1996 Henri Torgemane. All Rights Reserved.
*
* Permission to use, copy, modify, and distribute this software
* and its documentation for any purposes and without
* fee is hereby granted provided that this copyright notice
* appears in all copies.
*
* Of course, this soft is provided "as is" without express or implied
* warranty of any kind.
*/
// $Id: md5-1.js 11771 2005-12-26 23:07:31Z mjs $
function array(n) {
for(i=0;i<n;i++) this[i]=0;
this.length=n;
}
/* Some basic logical functions had to be rewritten because of a bug in
* Javascript.. Just try to compute 0xffffffff >> 4 with it..
* Of course, these functions are slower than the original would be, but
* at least, they work!
*/
function integer(n) { return n%(0xffffffff+1); }
function shr(a,b) {
a=integer(a);
b=integer(b);
if (a-0x80000000>=0) {
       a=a%0x80000000;
       a>>=b;
       a+=0x40000000>>(b-1);
} else
       a>>=b;
return a;
}
function shl1(a) {
a=a%0x80000000;
if (a&0x40000000==0x40000000)
       {
        a-=0x40000000;
        a*=2;
        a+=0x80000000;
       } else
        a*=2;
return a;
}
function shl(a,b) {
a=integer(a);
b=integer(b);
for (var i=0;i<b;i++) a=shl1(a);
return a;
}
function and(a,b) {
a=integer(a);
b=integer(b);
var t1=(a-0x80000000);
var t2=(b-0x80000000);
if (t1>=0)
       if (t2>=0)
        return ((t1&t2)+0x80000000);
       else
        return (t1&b);
else
       if (t2>=0)
        return (a&t2);
       else
        return (a&b);
}
function or(a,b) {
a=integer(a);
b=integer(b);
var t1=(a-0x80000000);
var t2=(b-0x80000000);
if (t1>=0)
       if (t2>=0)
        return ((t1|t2)+0x80000000);
       else
        return ((t1|b)+0x80000000);
else
       if (t2>=0)
        return ((a|t2)+0x80000000);
       else
        return (a|b);
}
function xor(a,b) {
a=integer(a);
b=integer(b);
var t1=(a-0x80000000);
var t2=(b-0x80000000);
if (t1>=0)
       if (t2>=0)
        return (t1^t2);
       else
        return ((t1^b)+0x80000000);
else
       if (t2>=0)
        return ((a^t2)+0x80000000);
       else
        return (a^b);
}
function not(a) {
a=integer(a);
return (0xffffffff-a);
}
/* Here begin the real algorithm */
var state = new array(4);
var count = new array(2);
count[0] = 0;
count[1] = 0;
var buffer = new array(64);
var transformBuffer = new array(16);
var digestBits = new array(16);
var S11 = 7;
var S12 = 12;
var S13 = 17;
var S14 = 22;
var S21 = 5;
var S22 = 9;
var S23 = 14;
var S24 = 20;
var S31 = 4;
var S32 = 11;
var S33 = 16;
var S34 = 23;
var S41 = 6;
var S42 = 10;
var S43 = 15;
var S44 = 21;
function F(x,y,z) {
return or(and(x,y),and(not(x),z));
}
function G(x,y,z) {
return or(and(x,z),and(y,not(z)));
}
function H(x,y,z) {
return xor(xor(x,y),z);
}
function I(x,y,z) {
return xor(y ,or(x , not(z)));
}
function rotateLeft(a,n) {
return or(shl(a, n),(shr(a,(32 - n))));
}
function FF(a,b,c,d,x,s,ac) {
a = a+F(b, c, d) + x + ac;
a = rotateLeft(a, s);
a = a+b;
return a;
}
function GG(a,b,c,d,x,s,ac) {
a = a+G(b, c, d) +x + ac;
a = rotateLeft(a, s);
a = a+b;
return a;
}
function HH(a,b,c,d,x,s,ac) {
a = a+H(b, c, d) + x + ac;
a = rotateLeft(a, s);
a = a+b;
return a;
}
function II(a,b,c,d,x,s,ac) {
a = a+I(b, c, d) + x + ac;
a = rotateLeft(a, s);
a = a+b;
return a;
}
function transform(buf,offset) {
var a=0, b=0, c=0, d=0;
var x = transformBuffer;
a = state[0];
b = state[1];
c = state[2];
d = state[3];
for (i = 0; i < 16; i++) {
       x[i] = and(buf[i*4+offset],0xff);
       for (j = 1; j < 4; j++) {
        x[i]+=shl(and(buf[i*4+j+offset] ,0xff), j * 8);
       }
}
/* Round 1 */
a = FF ( a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
d = FF ( d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
c = FF ( c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
b = FF ( b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
a = FF ( a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
d = FF ( d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
c = FF ( c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
b = FF ( b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
a = FF ( a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
d = FF ( d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
c = FF ( c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
b = FF ( b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
a = FF ( a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
d = FF ( d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
c = FF ( c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
b = FF ( b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
/* Round 2 */
a = GG ( a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
d = GG ( d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
c = GG ( c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
b = GG ( b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
a = GG ( a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
d = GG ( d, a, b, c, x[10], S22, 0x2441453); /* 22 */
c = GG ( c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
b = GG ( b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
a = GG ( a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
d = GG ( d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
c = GG ( c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
b = GG ( b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
a = GG ( a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
d = GG ( d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
c = GG ( c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
b = GG ( b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
/* Round 3 */
a = HH ( a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
d = HH ( d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
c = HH ( c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
b = HH ( b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
a = HH ( a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
d = HH ( d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
c = HH ( c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
b = HH ( b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
a = HH ( a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
d = HH ( d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
c = HH ( c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
b = HH ( b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
a = HH ( a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
d = HH ( d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
c = HH ( c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
b = HH ( b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
/* Round 4 */
a = II ( a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
d = II ( d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
c = II ( c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
b = II ( b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
a = II ( a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
d = II ( d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
c = II ( c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
b = II ( b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
a = II ( a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
d = II ( d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
c = II ( c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
b = II ( b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
a = II ( a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
d = II ( d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
c = II ( c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
b = II ( b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
state[0] +=a;
state[1] +=b;
state[2] +=c;
state[3] +=d;
}
function init() {
count[0]=count[1] = 0;
state[0] = 0x67452301;
state[1] = 0xefcdab89;
state[2] = 0x98badcfe;
state[3] = 0x10325476;
for (i = 0; i < digestBits.length; i++)
       digestBits[i] = 0;
}
function update(b) {
var index,i;
index = and(shr(count[0],3) , 0x3f);
if (count[0]<0xffffffff-7)
       count[0] += 8;
else {
       count[1]++;
       count[0]-=0xffffffff+1;
       count[0]+=8;
}
buffer[index] = and(b,0xff);
if (index >= 63) {
       transform(buffer, 0);
}
}
function finish() {
var bits = new array(8);
var padding;
var i=0, index=0, padLen=0;
for (i = 0; i < 4; i++) {
       bits[i] = and(shr(count[0],(i * 8)), 0xff);
}
for (i = 0; i < 4; i++) {
       bits[i+4]=and(shr(count[1],(i * 8)), 0xff);
}
index = and(shr(count[0], 3) ,0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
padding = new array(64);
padding[0] = 0x80;
for (i=0;i<padLen;i++)
       update(padding[i]);
for (i=0;i<8;i++)
       update(bits[i]);
for (i = 0; i < 4; i++) {
       for (j = 0; j < 4; j++) {
        digestBits[i*4+j] = and(shr(state[i], (j * 8)) , 0xff);
       }
}
}
/* End of the MD5 algorithm */
function hexa(n) {
var hexa_h = "0123456789abcdef";
var hexa_c="";
var hexa_m=n;
for (hexa_i=0;hexa_i<8;hexa_i++) {
       hexa_c=hexa_h.charAt(Math.abs(hexa_m)%16)+hexa_c;
       hexa_m=Math.floor(hexa_m/16);
}
return hexa_c;
}
var ascii="01234567890123456789012345678901" +
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"+
"[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
function MD5(entree)
{
var l,s,k,ka,kb,kc,kd;
init();
for (k=0;k<entree.length;k++) {
       l=entree.charAt(k);
       update(ascii.lastIndexOf(l));
}
finish();
ka=kb=kc=kd=0;
for (i=0;i<4;i++) ka+=shl(digestBits[15-i], (i*8));
for (i=4;i<8;i++) kb+=shl(digestBits[15-i], ((i-4)*8));
for (i=8;i<12;i++) kc+=shl(digestBits[15-i], ((i-8)*8));
for (i=12;i<16;i++) kd+=shl(digestBits[15-i], ((i-12)*8));
s=hexa(kd)+hexa(kc)+hexa(kb)+hexa(ka);
return s;
}
shouldBe("MD5('kde')", "'186cf28b76f2264e9fea8fcf91cb4f5d'");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS hexMD5('kde') is '186cf28b76f2264e9fea8fcf91cb4f5d'
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
shouldBe("hexMD5('kde')", "'186cf28b76f2264e9fea8fcf91cb4f5d'");
/*
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 1.1 Copyright (C) Paul Johnston 1999 - 2002.
* Code also contributed by Greg Holt
* See http://pajhome.org.uk/site/legal.html for details.
*/
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.
*/
function safe_add(x, y)
{
var lsw = (x & 0xFFFF) + (y & 0xFFFF)
var msw = (x >> 16) + (y >> 16) + (lsw >> 16)
return (msw << 16) | (lsw & 0xFFFF)
}
/*
* Bitwise rotate a 32-bit number to the left.
*/
function rol(num, cnt)
{
return (num << cnt) | (num >>> (32 - cnt))
}
/*
* These functions implement the four basic operations the algorithm uses.
*/
function cmn(q, a, b, x, s, t)
{
return safe_add(rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b)
}
function ff(a, b, c, d, x, s, t)
{
return cmn((b & c) | ((~b) & d), a, b, x, s, t)
}
function gg(a, b, c, d, x, s, t)
{
return cmn((b & d) | (c & (~d)), a, b, x, s, t)
}
function hh(a, b, c, d, x, s, t)
{
return cmn(b ^ c ^ d, a, b, x, s, t)
}
function ii(a, b, c, d, x, s, t)
{
return cmn(c ^ (b | (~d)), a, b, x, s, t)
}
/*
* Calculate the MD5 of an array of little-endian words, producing an array
* of little-endian words.
*/
function coreMD5(x)
{
var a = 1732584193
var b = -271733879
var c = -1732584194
var d = 271733878
for(i = 0; i < x.length; i += 16)
{
var olda = a
var oldb = b
var oldc = c
var oldd = d
a = ff(a, b, c, d, x[i+ 0], 7 , -680876936)
d = ff(d, a, b, c, x[i+ 1], 12, -389564586)
c = ff(c, d, a, b, x[i+ 2], 17, 606105819)
b = ff(b, c, d, a, x[i+ 3], 22, -1044525330)
a = ff(a, b, c, d, x[i+ 4], 7 , -176418897)
d = ff(d, a, b, c, x[i+ 5], 12, 1200080426)
c = ff(c, d, a, b, x[i+ 6], 17, -1473231341)
b = ff(b, c, d, a, x[i+ 7], 22, -45705983)
a = ff(a, b, c, d, x[i+ 8], 7 , 1770035416)
d = ff(d, a, b, c, x[i+ 9], 12, -1958414417)
c = ff(c, d, a, b, x[i+10], 17, -42063)
b = ff(b, c, d, a, x[i+11], 22, -1990404162)
a = ff(a, b, c, d, x[i+12], 7 , 1804603682)
d = ff(d, a, b, c, x[i+13], 12, -40341101)
c = ff(c, d, a, b, x[i+14], 17, -1502002290)
b = ff(b, c, d, a, x[i+15], 22, 1236535329)
a = gg(a, b, c, d, x[i+ 1], 5 , -165796510)
d = gg(d, a, b, c, x[i+ 6], 9 , -1069501632)
c = gg(c, d, a, b, x[i+11], 14, 643717713)
b = gg(b, c, d, a, x[i+ 0], 20, -373897302)
a = gg(a, b, c, d, x[i+ 5], 5 , -701558691)
d = gg(d, a, b, c, x[i+10], 9 , 38016083)
c = gg(c, d, a, b, x[i+15], 14, -660478335)
b = gg(b, c, d, a, x[i+ 4], 20, -405537848)
a = gg(a, b, c, d, x[i+ 9], 5 , 568446438)
d = gg(d, a, b, c, x[i+14], 9 , -1019803690)
c = gg(c, d, a, b, x[i+ 3], 14, -187363961)
b = gg(b, c, d, a, x[i+ 8], 20, 1163531501)
a = gg(a, b, c, d, x[i+13], 5 , -1444681467)
d = gg(d, a, b, c, x[i+ 2], 9 , -51403784)
c = gg(c, d, a, b, x[i+ 7], 14, 1735328473)
b = gg(b, c, d, a, x[i+12], 20, -1926607734)
a = hh(a, b, c, d, x[i+ 5], 4 , -378558)
d = hh(d, a, b, c, x[i+ 8], 11, -2022574463)
c = hh(c, d, a, b, x[i+11], 16, 1839030562)
b = hh(b, c, d, a, x[i+14], 23, -35309556)
a = hh(a, b, c, d, x[i+ 1], 4 , -1530992060)
d = hh(d, a, b, c, x[i+ 4], 11, 1272893353)
c = hh(c, d, a, b, x[i+ 7], 16, -155497632)
b = hh(b, c, d, a, x[i+10], 23, -1094730640)
a = hh(a, b, c, d, x[i+13], 4 , 681279174)
d = hh(d, a, b, c, x[i+ 0], 11, -358537222)
c = hh(c, d, a, b, x[i+ 3], 16, -722521979)
b = hh(b, c, d, a, x[i+ 6], 23, 76029189)
a = hh(a, b, c, d, x[i+ 9], 4 , -640364487)
d = hh(d, a, b, c, x[i+12], 11, -421815835)
c = hh(c, d, a, b, x[i+15], 16, 530742520)
b = hh(b, c, d, a, x[i+ 2], 23, -995338651)
a = ii(a, b, c, d, x[i+ 0], 6 , -198630844)
d = ii(d, a, b, c, x[i+ 7], 10, 1126891415)
c = ii(c, d, a, b, x[i+14], 15, -1416354905)
b = ii(b, c, d, a, x[i+ 5], 21, -57434055)
a = ii(a, b, c, d, x[i+12], 6 , 1700485571)
d = ii(d, a, b, c, x[i+ 3], 10, -1894986606)
c = ii(c, d, a, b, x[i+10], 15, -1051523)
b = ii(b, c, d, a, x[i+ 1], 21, -2054922799)
a = ii(a, b, c, d, x[i+ 8], 6 , 1873313359)
d = ii(d, a, b, c, x[i+15], 10, -30611744)
c = ii(c, d, a, b, x[i+ 6], 15, -1560198380)
b = ii(b, c, d, a, x[i+13], 21, 1309151649)
a = ii(a, b, c, d, x[i+ 4], 6 , -145523070)
d = ii(d, a, b, c, x[i+11], 10, -1120210379)
c = ii(c, d, a, b, x[i+ 2], 15, 718787259)
b = ii(b, c, d, a, x[i+ 9], 21, -343485551)
a = safe_add(a, olda)
b = safe_add(b, oldb)
c = safe_add(c, oldc)
d = safe_add(d, oldd)
}
return [a, b, c, d]
}
/*
* Convert an array of little-endian words to a hex string.
*/
function binl2hex(binarray)
{
var hex_tab = "0123456789abcdef"
var str = ""
for(var i = 0; i < binarray.length * 4; i++)
{
str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
hex_tab.charAt((binarray[i>>2] >> ((i%4)*8)) & 0xF)
}
return str
}
/*
* Convert an array of little-endian words to a base64 encoded string.
*/
function binl2b64(binarray)
{
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
var str = ""
for(var i = 0; i < binarray.length * 32; i += 6)
{
str += tab.charAt(((binarray[i>>5] << (i%32)) & 0x3F) |
((binarray[i>>5+1] >> (32-i%32)) & 0x3F))
}
return str
}
/*
* Convert an 8-bit character string to a sequence of 16-word blocks, stored
* as an array, and append appropriate padding for MD4/5 calculation.
* If any of the characters are >255, the high byte is silently ignored.
*/
function str2binl(str)
{
var nblk = ((str.length + 8) >> 6) + 1 // number of 16-word blocks
var blks = new Array(nblk * 16)
for(var i = 0; i < nblk * 16; i++) blks[i] = 0
for(var i = 0; i < str.length; i++)
blks[i>>2] |= (str.charCodeAt(i) & 0xFF) << ((i%4) * 8)
blks[i>>2] |= 0x80 << ((i%4) * 8)
blks[nblk*16-2] = str.length * 8
return blks
}
/*
* Convert a wide-character string to a sequence of 16-word blocks, stored as
* an array, and append appropriate padding for MD4/5 calculation.
*/
function strw2binl(str)
{
var nblk = ((str.length + 4) >> 5) + 1 // number of 16-word blocks
var blks = new Array(nblk * 16)
for(var i = 0; i < nblk * 16; i++) blks[i] = 0
for(var i = 0; i < str.length; i++)
blks[i>>1] |= str.charCodeAt(i) << ((i%2) * 16)
blks[i>>1] |= 0x80 << ((i%2) * 16)
blks[nblk*16-2] = str.length * 16
return blks
}
/*
* External interface
*/
function hexMD5 (str) { return binl2hex(coreMD5( str2binl(str))) }
function hexMD5w(str) { return binl2hex(coreMD5(strw2binl(str))) }
function b64MD5 (str) { return binl2b64(coreMD5( str2binl(str))) }
function b64MD5w(str) { return binl2b64(coreMD5(strw2binl(str))) }
/* Backward compatibility */
function calcMD5(str) { return binl2hex(coreMD5( str2binl(str))) }
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS sub.x is 1
PASS sub.y is 2
PASS sub.hasOwnProperty('x') is false
PASS sub.hasOwnProperty('y') is true
PASS sub.x is 6
PASS sub.hasOwnProperty('x') is true
PASS sub.y is undefined
PASS sub.hasOwnProperty('y') is false
PASS obj.hasClass1 is true
PASS obj.hasClass2 is true
PASS obj.hasClass3 is true
PASS Class1.prototype.isPrototypeOf(obj) is true
PASS Class2.prototype.isPrototypeOf(obj) is true
PASS Class3.prototype.isPrototypeOf(obj) is true
PASS obj.isPrototypeOf(Class1.prototype) is false
PASS obj.isPrototypeOf(Class2.prototype) is false
PASS obj.isPrototypeOf(Class3.prototype) is false
PASS Class1.prototype.isPrototypeOf(Class2.prototype) is true
PASS Class2.prototype.isPrototypeOf(Class1.prototype) is false
PASS Class1.prototype.isPrototypeOf(Class3.prototype) is true
PASS Class3.prototype.isPrototypeOf(Class1.prototype) is false
PASS Class2.prototype.isPrototypeOf(Class3.prototype) is true
PASS Class3.prototype.isPrototypeOf(Class2.prototype) is false
PASS Class1.prototype.prototype is undefined.
PASS myfunc.length is 3
PASS myfunc.someproperty is 4
PASS myfunc.propertyIsEnumerable('length') is false
PASS myfunc.propertyIsEnumerable('someproperty') is true
PASS checkEnumerable(myfunc,'length') is false
PASS checkEnumerable(myfunc,'someproperty') is true
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
// Object.prototype.hasOwnProperty
function MyClass()
{
this.y = 2;
}
MyClass.prototype = { x : 1 };
var sub = new MyClass();
shouldBe("sub.x","1");
shouldBe("sub.y","2");
shouldBe("sub.hasOwnProperty('x')","false");
shouldBe("sub.hasOwnProperty('y')","true");
sub.x = 6;
shouldBe("sub.x","6");
shouldBe("sub.hasOwnProperty('x')","true");
delete sub.y;
shouldBe("sub.y","undefined");
shouldBe("sub.hasOwnProperty('y')","false");
// Object.prototype.isPrototypeOf
function Class1() {}
function Class2() {}
function Class3() {}
Class1.prototype = new Object();
Class1.prototype.hasClass1 = true;
Class2.prototype = new Class1();
Class2.prototype.hasClass2 = true;
Class3.prototype = new Class2();
Class3.prototype.hasClass3 = true;
var obj = new Class3();
shouldBe("obj.hasClass1","true");
shouldBe("obj.hasClass2","true");
shouldBe("obj.hasClass3","true");
shouldBe("Class1.prototype.isPrototypeOf(obj)","true");
shouldBe("Class2.prototype.isPrototypeOf(obj)","true");
shouldBe("Class3.prototype.isPrototypeOf(obj)","true");
shouldBe("obj.isPrototypeOf(Class1.prototype)","false");
shouldBe("obj.isPrototypeOf(Class2.prototype)","false");
shouldBe("obj.isPrototypeOf(Class3.prototype)","false");
shouldBe("Class1.prototype.isPrototypeOf(Class2.prototype)","true");
shouldBe("Class2.prototype.isPrototypeOf(Class1.prototype)","false");
shouldBe("Class1.prototype.isPrototypeOf(Class3.prototype)","true");
shouldBe("Class3.prototype.isPrototypeOf(Class1.prototype)","false");
shouldBe("Class2.prototype.isPrototypeOf(Class3.prototype)","true");
shouldBe("Class3.prototype.isPrototypeOf(Class2.prototype)","false");
shouldBeUndefined("Class1.prototype.prototype");
function checkEnumerable(obj,property)
{
for (var propname in obj) {
if (propname == property)
return true;
}
return false;
}
function myfunc(a,b,c)
{
}
myfunc.someproperty = 4;
shouldBe("myfunc.length","3");
shouldBe("myfunc.someproperty","4");
shouldBe("myfunc.propertyIsEnumerable('length')","false");
shouldBe("myfunc.propertyIsEnumerable('someproperty')","true");
shouldBe("checkEnumerable(myfunc,'length')","false");
shouldBe("checkEnumerable(myfunc,'someproperty')","true");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS _array.toString() is "[object Array]"
PASS _string.toString() is "[object String]"
PASS _boolean.toString() is "[object Boolean]"
PASS _number.toString() is "[object Number]"
PASS _object.toString() is "[object Object]"
PASS _date.toString() is "[object Date]"
PASS _regexp.toString() is "[object RegExp]"
PASS _error.toString() is "[object Error]"
PASS _function.toString() is "[object Function]"
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
var _array = new Array(1,2,3);
_array.toString = Object.prototype.toString;
shouldBe("_array.toString()","\"[object Array]\"");
var _string = new String("test");
_string.toString = Object.prototype.toString;
shouldBe("_string.toString()","\"[object String]\"");
var _boolean = new Boolean(true);
_boolean.toString = Object.prototype.toString;
shouldBe("_boolean.toString()","\"[object Boolean]\"");
var _number = new Number(4);
_number.toString = Object.prototype.toString;
shouldBe("_number.toString()","\"[object Number]\"");
var _object = new Object();
_object.toString = Object.prototype.toString;
shouldBe("_object.toString()","\"[object Object]\"");
var _date = new Date();
_date.toString = Object.prototype.toString;
shouldBe("_date.toString()","\"[object Date]\"");
var _regexp = new RegExp();
_regexp.toString = Object.prototype.toString;
shouldBe("_regexp.toString()","\"[object RegExp]\"");
var _error = new Error();
_error.toString = Object.prototype.toString;
shouldBe("_error.toString()","\"[object Error]\"");
var _function = new Function();
_function.toString = Object.prototype.toString;
shouldBe("_function.toString()","\"[object Function]\"");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS !undefined is true
PASS !null is true
PASS !!true is true
PASS !false is true
PASS !!1 is true
PASS !0 is true
PASS !!'a' is true
PASS !'' is true
PASS nonSpeculativeNot(undefined) is true
PASS nonSpeculativeNot(null) is true
PASS nonSpeculativeNot(!true) is true
PASS nonSpeculativeNot(false) is true
PASS nonSpeculativeNot(!1) is true
PASS nonSpeculativeNot(0) is true
PASS nonSpeculativeNot(!'a') is true
PASS nonSpeculativeNot('') is true
PASS +9 is 9
PASS var i = 10; +i is 10
PASS -11 is -11
PASS var i = 12; -i is -12
PASS var i = 0; ++i; is 1
PASS var i = 0; ++i; i is 1
PASS var i = 0; i++; is 0
PASS var i = 0; i++; i is 1
PASS var i = true; i++ is 1
PASS var i = true; i++; i is 2
PASS var i = 0; --i; is -1
PASS var i = 0; --i; i is -1
PASS var i = 0; i--; is 0
PASS var i = 0; i--; i is -1
PASS var i = true; i-- is 1
PASS var i = true; i--; i is 0
PASS ~0 is -1
PASS ~1 is -2
PASS ~NaN is -1
PASS ~Infinity is -1
PASS ~Math.pow(2, 33) is -1
PASS ~(Math.pow(2, 32) + Math.pow(2, 31) + 2) is 2147483645
PASS ~null is -1
PASS 3 & 1 is 1
PASS 2 | true is 3
PASS '3' ^ 1 is 2
PASS 3^4&5 is 7
PASS 2|4^5 is 3
PASS 1 << 2 is 4
PASS 8 >> 1 is 4
PASS 1 >> 2 is 0
PASS -8 >> 24 is -1
PASS 8 >>> 2 is 2
PASS -8 >>> 24 is 255
PASS (-2200000000 >> 1) << 1 is 2094967296
PASS Infinity >> 1 is 0
PASS Infinity << 1 is 0
PASS Infinity >>> 1 is 0
PASS NaN >> 1 is 0
PASS NaN << 1 is 0
PASS NaN >>> 1 is 0
PASS 8.1 >> 1 is 4
PASS 8.1 << 1 is 16
PASS 8.1 >>> 1 is 4
PASS 8.9 >> 1 is 4
PASS 8.9 << 1 is 16
PASS 8.9 >>> 1 is 4
PASS Math.pow(2, 32) >> 1 is 0
PASS Math.pow(2, 32) << 1 is 0
PASS Math.pow(2, 32) >>> 1 is 0
PASS 1 << two is 4
PASS 8 >> one is 4
PASS 1 >> two is 0
PASS -8 >> twentyFour is -1
PASS 8 >>> two is 2
PASS -8 >>> twentyFour is 255
PASS (-2200000000 >> one) << one is 2094967296
PASS Infinity >> one is 0
PASS Infinity << one is 0
PASS Infinity >>> one is 0
PASS NaN >> one is 0
PASS NaN << one is 0
PASS NaN >>> one is 0
PASS 888.1 >> one is 444
PASS 888.1 << one is 1776
PASS 888.1 >>> one is 444
PASS 888.9 >> one is 444
PASS 888.9 << one is 1776
PASS 888.9 >>> one is 444
PASS Math.pow(2, 32) >> one is 0
PASS Math.pow(2, 32) << one is 0
PASS Math.pow(2, 32) >>> one is 0
PASS 1+2 is 3
PASS 'a'+'b' is 'ab'
PASS 'a'+2 is 'a2'
PASS '2'+'-1' is '2-1'
PASS true+'a' is 'truea'
PASS 'a' + null is 'anull'
PASS true+1 is 2
PASS false+null is 0
PASS 1-3 is -2
PASS isNaN('a'-3) is true
PASS '3'-'-1' is 4
PASS '4'-2 is 2
PASS true-false is 1
PASS false-1 is -1
PASS null-true is -1
PASS 2 * 3 is 6
PASS true * 3 is 3
PASS 2 * '3' is 6
PASS 6 / 4 is 1.5
PASS '6' / '2' is 3
PASS isNaN('x' / 1) is true
PASS isNaN(1 / NaN) is true
PASS isNaN(Infinity / Infinity) is true
PASS Infinity / 0 is Infinity
PASS -Infinity / 0 is -Infinity
PASS Infinity / 1 is Infinity
PASS -Infinity / 1 is -Infinity
PASS 1 / Infinity == +0 is true
PASS 1 / -Infinity == -0 is true
PASS isNaN(0/0) is true
PASS 0 / 1 === 0 is true
PASS 0 / -1 === -0 is true
PASS 1 / 0 is Infinity
PASS -1 / 0 is -Infinity
PASS 6 % 4 is 2
PASS '-6' % 4 is -2
PASS 2==2 is true
PASS 1==2 is false
PASS nonSpeculativeEqual(2,2) is true
PASS nonSpeculativeEqual(1,2) is false
PASS 1<2 is true
PASS 1<=2 is true
PASS 2<1 is false
PASS 2<=1 is false
PASS nonSpeculativeLess(1,2) is true
PASS nonSpeculativeLessEq(1,2) is true
PASS nonSpeculativeLess(2,1) is false
PASS nonSpeculativeLessEq(2,1) is false
PASS 2>1 is true
PASS 2>=1 is true
PASS 1>=2 is false
PASS 1>2 is false
PASS nonSpeculativeGreater(2,1) is true
PASS nonSpeculativeGreaterEq(2,1) is true
PASS nonSpeculativeGreaterEq(1,2) is false
PASS nonSpeculativeGreater(1,2) is false
PASS 'abc' == 'abc' is true
PASS 'abc' != 'xyz' is true
PASS true == true is true
PASS false == false is true
PASS true != false is true
PASS 'a' != null is true
PASS 'a' != undefined is true
PASS null == null is true
PASS null == undefined is true
PASS undefined == undefined is true
PASS NaN != NaN is true
PASS true != undefined is true
PASS true != null is true
PASS false != undefined is true
PASS false != null is true
PASS '0' == 0 is true
PASS 1 == '1' is true
PASS NaN != NaN is true
PASS NaN != 0 is true
PASS NaN != undefined is true
PASS true == 1 is true
PASS true != 2 is true
PASS 1 == true is true
PASS false == 0 is true
PASS 0 == false is true
PASS nonSpeculativeEqual('abc', 'abc') is true
PASS nonSpeculativeNotEqual('abc', 'xyz') is true
PASS nonSpeculativeEqual(true, true) is true
PASS nonSpeculativeEqual(false, false) is true
PASS nonSpeculativeNotEqual(true, false) is true
PASS nonSpeculativeNotEqual('a', null) is true
PASS nonSpeculativeNotEqual('a', undefined) is true
PASS nonSpeculativeEqual(null, null) is true
PASS nonSpeculativeEqual(null, undefined) is true
PASS nonSpeculativeEqual(undefined, undefined) is true
PASS nonSpeculativeNotEqual(NaN, NaN) is true
PASS nonSpeculativeNotEqual(true, undefined) is true
PASS nonSpeculativeNotEqual(true, null) is true
PASS nonSpeculativeNotEqual(false, undefined) is true
PASS nonSpeculativeNotEqual(false, null) is true
PASS nonSpeculativeEqual('0', 0) is true
PASS nonSpeculativeEqual(1, '1') is true
PASS nonSpeculativeNotEqual(NaN, NaN) is true
PASS nonSpeculativeNotEqual(NaN, 0) is true
PASS nonSpeculativeNotEqual(NaN, undefined) is true
PASS nonSpeculativeEqual(true, 1) is true
PASS nonSpeculativeNotEqual(true, 2) is true
PASS nonSpeculativeEqual(1, true) is true
PASS nonSpeculativeEqual(false, 0) is true
PASS nonSpeculativeEqual(0, false) is true
PASS 'abc' < 'abx' is true
PASS 'abc' < 'abcd' is true
PASS 'abc' < 'abc' is false
PASS 'abcd' < 'abcd' is false
PASS 'abx' < 'abc' is false
PASS nonSpeculativeLess('abc', 'abx') is true
PASS nonSpeculativeLess('abc', 'abcd') is true
PASS nonSpeculativeLess('abc', 'abc') is false
PASS nonSpeculativeLess('abcd', 'abcd') is false
PASS nonSpeculativeLess('abx', 'abc') is false
PASS 'abc' <= 'abc' is true
PASS 'abc' <= 'abx' is true
PASS 'abx' <= 'abc' is false
PASS 'abcd' <= 'abc' is false
PASS 'abc' <= 'abcd' is true
PASS nonSpeculativeLessEq('abc', 'abc') is true
PASS nonSpeculativeLessEq('abc', 'abx') is true
PASS nonSpeculativeLessEq('abx', 'abc') is false
PASS nonSpeculativeLessEq('abcd', 'abc') is false
PASS nonSpeculativeLessEq('abc', 'abcd') is true
PASS 'abc' > 'abx' is false
PASS 'abc' > 'abc' is false
PASS 'abcd' > 'abc' is true
PASS 'abx' > 'abc' is true
PASS 'abc' > 'abcd' is false
PASS nonSpeculativeGreater('abc', 'abx') is false
PASS nonSpeculativeGreater('abc', 'abc') is false
PASS nonSpeculativeGreater('abcd', 'abc') is true
PASS nonSpeculativeGreater('abx', 'abc') is true
PASS nonSpeculativeGreater('abc', 'abcd') is false
PASS 'abc' >= 'abc' is true
PASS 'abcd' >= 'abc' is true
PASS 'abx' >= 'abc' is true
PASS 'abc' >= 'abx' is false
PASS 'abc' >= 'abx' is false
PASS 'abc' >= 'abcd' is false
PASS nonSpeculativeGreaterEq('abc', 'abc') is true
PASS nonSpeculativeGreaterEq('abcd', 'abc') is true
PASS nonSpeculativeGreaterEq('abx', 'abc') is true
PASS nonSpeculativeGreaterEq('abc', 'abx') is false
PASS nonSpeculativeGreaterEq('abc', 'abx') is false
PASS nonSpeculativeGreaterEq('abc', 'abcd') is false
PASS 'abc' <= 0 is false
PASS '' <= 0 is true
PASS ' ' <= 0 is true
PASS null <= 0 is true
PASS 0 <= 'abc' is false
PASS 0 <= '' is true
PASS 0 <= null is true
PASS null <= null is true
PASS 6 < '52' is true
PASS 6 < '72' is true
PASS NaN < 0 is false
PASS NaN <= 0 is false
PASS NaN > 0 is false
PASS NaN >= 0 is false
PASS nonSpeculativeLessEq('abc', 0) is false
PASS nonSpeculativeLessEq('', 0) is true
PASS nonSpeculativeLessEq(' ', 0) is true
PASS nonSpeculativeLessEq(null, 0) is true
PASS nonSpeculativeLessEq(0, 'abc') is false
PASS nonSpeculativeLessEq(0, '') is true
PASS nonSpeculativeLessEq(0, null) is true
PASS nonSpeculativeLessEq(null, null) is true
PASS nonSpeculativeLess(6, '52') is true
PASS nonSpeculativeLess(6, '72') is true
PASS nonSpeculativeLess(NaN, 0) is false
PASS nonSpeculativeLessEq(NaN, 0) is false
PASS nonSpeculativeGreater(NaN, 0) is false
PASS nonSpeculativeGreaterEq(NaN, 0) is false
PASS 0 === false is false
PASS null === null is true
PASS NaN === NaN is false
PASS 0.0 === 0 is true
PASS 'abc' === 'abc' is true
PASS 'a' === 'x' is false
PASS 1 === '1' is false
PASS '1' === 1 is false
PASS true === true is true
PASS false === false is true
PASS true === false is false
PASS Math === Math is true
PASS Math === Boolean is false
PASS Infinity === Infinity is true
PASS nonSpeculativeStrictEqual(0, false) is false
PASS nonSpeculativeStrictEqual(null, null) is true
PASS nonSpeculativeStrictEqual(NaN, NaN) is false
PASS nonSpeculativeStrictEqual(0.0, 0) is true
PASS nonSpeculativeStrictEqual('abc', 'abc') is true
PASS nonSpeculativeStrictEqual('a', 'x') is false
PASS nonSpeculativeStrictEqual(1, '1') is false
PASS nonSpeculativeStrictEqual('1', 1) is false
PASS nonSpeculativeStrictEqual(true, true) is true
PASS nonSpeculativeStrictEqual(false, false) is true
PASS nonSpeculativeStrictEqual(true, false) is false
PASS nonSpeculativeStrictEqual(Math, Math) is true
PASS nonSpeculativeStrictEqual(Math, Boolean) is false
PASS nonSpeculativeStrictEqual(Infinity, Infinity) is true
PASS 0 !== 0 is false
PASS 0 !== 1 is true
PASS nonSpeculativeStrictNotEqual(0, 0) is false
PASS nonSpeculativeStrictNotEqual(0, 1) is true
PASS typeof undefined is 'undefined'
PASS typeof null is 'object'
PASS typeof true is 'boolean'
PASS typeof false is 'boolean'
PASS typeof 1 is 'number'
PASS typeof 'a' is 'string'
PASS typeof shouldBe is 'function'
PASS typeof Number.NaN is 'number'
PASS 11 && 22 is 22
PASS null && true is null
PASS 11 || 22 is 11
PASS null || 'a' is 'a'
PASS void 1 is undefined.
PASS 1 in [1, 2] is true
PASS 3 in [1, 2] is false
PASS 'a' in { a:1, b:2 } is true
PASS (new Boolean()) instanceof Boolean is true
PASS (new Boolean()) instanceof Number is false
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
function nonSpeculativeNotInner(argument, o1, o2)
{
// The + operator on objects is a reliable way to avoid the speculative JIT path for now at least.
o1 + o2;
return !argument;
}
function nonSpeculativeNot(argument)
{
return nonSpeculativeNotInner(argument, {}, {});
}
function nonSpeculativeLessInner(a, b, o1, o2)
{
// The + operator on objects is a reliable way to avoid the speculative JIT path for now at least.
o1 + o2;
return a < b;
}
function nonSpeculativeLess(a, b)
{
return nonSpeculativeLessInner(a, b, {}, {});
}
function nonSpeculativeLessEqInner(a, b, o1, o2)
{
// The + operator on objects is a reliable way to avoid the speculative JIT path for now at least.
o1 + o2;
return a <= b;
}
function nonSpeculativeLessEq(a, b)
{
return nonSpeculativeLessEqInner(a, b, {}, {});
}
function nonSpeculativeGreaterInner(a, b, o1, o2)
{
// The + operator on objects is a reliable way to avoid the speculative JIT path for now at least.
o1 + o2;
return a > b;
}
function nonSpeculativeGreater(a, b)
{
return nonSpeculativeGreaterInner(a, b, {}, {});
}
function nonSpeculativeGreaterEqInner(a, b, o1, o2)
{
// The + operator on objects is a reliable way to avoid the speculative JIT path for now at least.
o1 + o2;
return a >= b;
}
function nonSpeculativeGreaterEq(a, b)
{
return nonSpeculativeGreaterEqInner(a, b, {}, {});
}
function nonSpeculativeEqualInner(a, b, o1, o2)
{
// The + operator on objects is a reliable way to avoid the speculative JIT path for now at least.
o1 + o2;
return a == b;
}
function nonSpeculativeEqual(a, b)
{
return nonSpeculativeEqualInner(a, b, {}, {});
}
function nonSpeculativeNotEqualInner(a, b, o1, o2)
{
// The + operator on objects is a reliable way to avoid the speculative JIT path for now at least.
o1 + o2;
return a != b;
}
function nonSpeculativeNotEqual(a, b)
{
return nonSpeculativeNotEqualInner(a, b, {}, {});
}
function nonSpeculativeStrictEqualInner(a, b, o1, o2)
{
// The + operator on objects is a reliable way to avoid the speculative JIT path for now at least.
o1 + o2;
return a === b;
}
function nonSpeculativeStrictEqual(a, b)
{
return nonSpeculativeStrictEqualInner(a, b, {}, {});
}
function nonSpeculativeStrictNotEqualInner(a, b, o1, o2)
{
// The + operator on objects is a reliable way to avoid the speculative JIT path for now at least.
o1 + o2;
return a !== b;
}
function nonSpeculativeStrictNotEqual(a, b)
{
return nonSpeculativeStrictNotEqualInner(a, b, {}, {});
}
// operator !
shouldBeTrue("!undefined");
shouldBeTrue("!null");
shouldBeTrue("!!true");
shouldBeTrue("!false");
shouldBeTrue("!!1");
shouldBeTrue("!0");
shouldBeTrue("!!'a'");
shouldBeTrue("!''");
shouldBeTrue("nonSpeculativeNot(undefined)");
shouldBeTrue("nonSpeculativeNot(null)");
shouldBeTrue("nonSpeculativeNot(!true)");
shouldBeTrue("nonSpeculativeNot(false)");
shouldBeTrue("nonSpeculativeNot(!1)");
shouldBeTrue("nonSpeculativeNot(0)");
shouldBeTrue("nonSpeculativeNot(!'a')");
shouldBeTrue("nonSpeculativeNot('')");
// unary plus
shouldBe("+9", "9");
shouldBe("var i = 10; +i", "10");
// negation
shouldBe("-11", "-11");
shouldBe("var i = 12; -i", "-12");
// increment
shouldBe("var i = 0; ++i;", "1");
shouldBe("var i = 0; ++i; i", "1");
shouldBe("var i = 0; i++;", "0");
shouldBe("var i = 0; i++; i", "1");
shouldBe("var i = true; i++", "1");
shouldBe("var i = true; i++; i", "2");
// decrement
shouldBe("var i = 0; --i;", "-1");
shouldBe("var i = 0; --i; i", "-1");
shouldBe("var i = 0; i--;", "0");
shouldBe("var i = 0; i--; i", "-1");
shouldBe("var i = true; i--", "1");
shouldBe("var i = true; i--; i", "0");
// bitwise operators
shouldBe("~0", "-1");
shouldBe("~1", "-2");
shouldBe("~NaN", "-1");
shouldBe("~Infinity", "-1");
shouldBe("~Math.pow(2, 33)", "-1"); // 32 bit overflow
shouldBe("~(Math.pow(2, 32) + Math.pow(2, 31) + 2)",
"2147483645"); // a signedness issue
shouldBe("~null", "-1");
shouldBe("3 & 1", "1");
shouldBe("2 | true", "3");
shouldBe("'3' ^ 1", "2");
shouldBe("3^4&5", "7");
shouldBe("2|4^5", "3");
shouldBe("1 << 2", "4");
shouldBe("8 >> 1", "4");
shouldBe("1 >> 2", "0");
shouldBe("-8 >> 24", "-1");
shouldBe("8 >>> 2", "2");
shouldBe("-8 >>> 24", "255");
shouldBe("(-2200000000 >> 1) << 1", "2094967296");
shouldBe("Infinity >> 1", "0");
shouldBe("Infinity << 1", "0");
shouldBe("Infinity >>> 1", "0");
shouldBe("NaN >> 1", "0");
shouldBe("NaN << 1", "0");
shouldBe("NaN >>> 1", "0");
shouldBe("8.1 >> 1", "4");
shouldBe("8.1 << 1", "16");
shouldBe("8.1 >>> 1", "4");
shouldBe("8.9 >> 1", "4");
shouldBe("8.9 << 1", "16");
shouldBe("8.9 >>> 1", "4");
shouldBe("Math.pow(2, 32) >> 1", "0");
shouldBe("Math.pow(2, 32) << 1", "0");
shouldBe("Math.pow(2, 32) >>> 1", "0");
// Try shifting by variables, to test non-constant-folded cases.
var one = 1;
var two = 2;
var twentyFour = 24;
shouldBe("1 << two", "4");
shouldBe("8 >> one", "4");
shouldBe("1 >> two", "0");
shouldBe("-8 >> twentyFour", "-1");
shouldBe("8 >>> two", "2");
shouldBe("-8 >>> twentyFour", "255");
shouldBe("(-2200000000 >> one) << one", "2094967296");
shouldBe("Infinity >> one", "0");
shouldBe("Infinity << one", "0");
shouldBe("Infinity >>> one", "0");
shouldBe("NaN >> one", "0");
shouldBe("NaN << one", "0");
shouldBe("NaN >>> one", "0");
shouldBe("888.1 >> one", "444");
shouldBe("888.1 << one", "1776");
shouldBe("888.1 >>> one", "444");
shouldBe("888.9 >> one", "444");
shouldBe("888.9 << one", "1776");
shouldBe("888.9 >>> one", "444");
shouldBe("Math.pow(2, 32) >> one", "0");
shouldBe("Math.pow(2, 32) << one", "0");
shouldBe("Math.pow(2, 32) >>> one", "0");
// addition
shouldBe("1+2", "3");
shouldBe("'a'+'b'", "'ab'");
shouldBe("'a'+2", "'a2'");
shouldBe("'2'+'-1'", "'2-1'");
shouldBe("true+'a'", "'truea'");
shouldBe("'a' + null", "'anull'");
shouldBe("true+1", "2");
shouldBe("false+null", "0");
// substraction
shouldBe("1-3", "-2");
shouldBe("isNaN('a'-3)", "true");
shouldBe("'3'-'-1'", "4");
shouldBe("'4'-2", "2");
shouldBe("true-false", "1");
shouldBe("false-1", "-1");
shouldBe("null-true", "-1");
// multiplication
shouldBe("2 * 3", "6");
shouldBe("true * 3", "3");
shouldBe("2 * '3'", "6");
// division
shouldBe("6 / 4", "1.5");
//shouldBe("true / false", "Inf");
shouldBe("'6' / '2'", "3");
shouldBeTrue("isNaN('x' / 1)");
shouldBeTrue("isNaN(1 / NaN)");
shouldBeTrue("isNaN(Infinity / Infinity)");
shouldBe("Infinity / 0", "Infinity");
shouldBe("-Infinity / 0", "-Infinity");
shouldBe("Infinity / 1", "Infinity");
shouldBe("-Infinity / 1", "-Infinity");
shouldBeTrue("1 / Infinity == +0");
shouldBeTrue("1 / -Infinity == -0"); // how to check ?
shouldBeTrue("isNaN(0/0)");
shouldBeTrue("0 / 1 === 0");
shouldBeTrue("0 / -1 === -0"); // how to check ?
shouldBe("1 / 0", "Infinity");
shouldBe("-1 / 0", "-Infinity");
// modulo
shouldBe("6 % 4", "2");
shouldBe("'-6' % 4", "-2");
shouldBe("2==2", "true");
shouldBe("1==2", "false");
shouldBe("nonSpeculativeEqual(2,2)", "true");
shouldBe("nonSpeculativeEqual(1,2)", "false");
shouldBe("1<2", "true");
shouldBe("1<=2", "true");
shouldBe("2<1", "false");
shouldBe("2<=1", "false");
shouldBe("nonSpeculativeLess(1,2)", "true");
shouldBe("nonSpeculativeLessEq(1,2)", "true");
shouldBe("nonSpeculativeLess(2,1)", "false");
shouldBe("nonSpeculativeLessEq(2,1)", "false");
shouldBe("2>1", "true");
shouldBe("2>=1", "true");
shouldBe("1>=2", "false");
shouldBe("1>2", "false");
shouldBe("nonSpeculativeGreater(2,1)", "true");
shouldBe("nonSpeculativeGreaterEq(2,1)", "true");
shouldBe("nonSpeculativeGreaterEq(1,2)", "false");
shouldBe("nonSpeculativeGreater(1,2)", "false");
shouldBeTrue("'abc' == 'abc'");
shouldBeTrue("'abc' != 'xyz'");
shouldBeTrue("true == true");
shouldBeTrue("false == false");
shouldBeTrue("true != false");
shouldBeTrue("'a' != null");
shouldBeTrue("'a' != undefined");
shouldBeTrue("null == null");
shouldBeTrue("null == undefined");
shouldBeTrue("undefined == undefined");
shouldBeTrue("NaN != NaN");
shouldBeTrue("true != undefined");
shouldBeTrue("true != null");
shouldBeTrue("false != undefined");
shouldBeTrue("false != null");
shouldBeTrue("'0' == 0");
shouldBeTrue("1 == '1'");
shouldBeTrue("NaN != NaN");
shouldBeTrue("NaN != 0");
shouldBeTrue("NaN != undefined");
shouldBeTrue("true == 1");
shouldBeTrue("true != 2");
shouldBeTrue("1 == true");
shouldBeTrue("false == 0");
shouldBeTrue("0 == false");
shouldBeTrue("nonSpeculativeEqual('abc', 'abc')");
shouldBeTrue("nonSpeculativeNotEqual('abc', 'xyz')");
shouldBeTrue("nonSpeculativeEqual(true, true)");
shouldBeTrue("nonSpeculativeEqual(false, false)");
shouldBeTrue("nonSpeculativeNotEqual(true, false)");
shouldBeTrue("nonSpeculativeNotEqual('a', null)");
shouldBeTrue("nonSpeculativeNotEqual('a', undefined)");
shouldBeTrue("nonSpeculativeEqual(null, null)");
shouldBeTrue("nonSpeculativeEqual(null, undefined)");
shouldBeTrue("nonSpeculativeEqual(undefined, undefined)");
shouldBeTrue("nonSpeculativeNotEqual(NaN, NaN)");
shouldBeTrue("nonSpeculativeNotEqual(true, undefined)");
shouldBeTrue("nonSpeculativeNotEqual(true, null)");
shouldBeTrue("nonSpeculativeNotEqual(false, undefined)");
shouldBeTrue("nonSpeculativeNotEqual(false, null)");
shouldBeTrue("nonSpeculativeEqual('0', 0)");
shouldBeTrue("nonSpeculativeEqual(1, '1')");
shouldBeTrue("nonSpeculativeNotEqual(NaN, NaN)");
shouldBeTrue("nonSpeculativeNotEqual(NaN, 0)");
shouldBeTrue("nonSpeculativeNotEqual(NaN, undefined)");
shouldBeTrue("nonSpeculativeEqual(true, 1)");
shouldBeTrue("nonSpeculativeNotEqual(true, 2)");
shouldBeTrue("nonSpeculativeEqual(1, true)");
shouldBeTrue("nonSpeculativeEqual(false, 0)");
shouldBeTrue("nonSpeculativeEqual(0, false)");
shouldBe("'abc' < 'abx'", "true");
shouldBe("'abc' < 'abcd'", "true");
shouldBe("'abc' < 'abc'", "false");
shouldBe("'abcd' < 'abcd'", "false");
shouldBe("'abx' < 'abc'", "false");
shouldBe("nonSpeculativeLess('abc', 'abx')", "true");
shouldBe("nonSpeculativeLess('abc', 'abcd')", "true");
shouldBe("nonSpeculativeLess('abc', 'abc')", "false");
shouldBe("nonSpeculativeLess('abcd', 'abcd')", "false");
shouldBe("nonSpeculativeLess('abx', 'abc')", "false");
shouldBe("'abc' <= 'abc'", "true");
shouldBe("'abc' <= 'abx'", "true");
shouldBe("'abx' <= 'abc'", "false");
shouldBe("'abcd' <= 'abc'", "false");
shouldBe("'abc' <= 'abcd'", "true");
shouldBe("nonSpeculativeLessEq('abc', 'abc')", "true");
shouldBe("nonSpeculativeLessEq('abc', 'abx')", "true");
shouldBe("nonSpeculativeLessEq('abx', 'abc')", "false");
shouldBe("nonSpeculativeLessEq('abcd', 'abc')", "false");
shouldBe("nonSpeculativeLessEq('abc', 'abcd')", "true");
shouldBe("'abc' > 'abx'", "false");
shouldBe("'abc' > 'abc'", "false");
shouldBe("'abcd' > 'abc'", "true");
shouldBe("'abx' > 'abc'", "true");
shouldBe("'abc' > 'abcd'", "false");
shouldBe("nonSpeculativeGreater('abc', 'abx')", "false");
shouldBe("nonSpeculativeGreater('abc', 'abc')", "false");
shouldBe("nonSpeculativeGreater('abcd', 'abc')", "true");
shouldBe("nonSpeculativeGreater('abx', 'abc')", "true");
shouldBe("nonSpeculativeGreater('abc', 'abcd')", "false");
shouldBe("'abc' >= 'abc'", "true");
shouldBe("'abcd' >= 'abc'", "true");
shouldBe("'abx' >= 'abc'", "true");
shouldBe("'abc' >= 'abx'", "false");
shouldBe("'abc' >= 'abx'", "false");
shouldBe("'abc' >= 'abcd'", "false");
shouldBe("nonSpeculativeGreaterEq('abc', 'abc')", "true");
shouldBe("nonSpeculativeGreaterEq('abcd', 'abc')", "true");
shouldBe("nonSpeculativeGreaterEq('abx', 'abc')", "true");
shouldBe("nonSpeculativeGreaterEq('abc', 'abx')", "false");
shouldBe("nonSpeculativeGreaterEq('abc', 'abx')", "false");
shouldBe("nonSpeculativeGreaterEq('abc', 'abcd')", "false");
// mixed strings and numbers - results validated in NS+moz+IE5
shouldBeFalse("'abc' <= 0"); // #35246
shouldBeTrue("'' <= 0");
shouldBeTrue("' ' <= 0");
shouldBeTrue("null <= 0");
shouldBeFalse("0 <= 'abc'");
shouldBeTrue("0 <= ''");
shouldBeTrue("0 <= null");
shouldBeTrue("null <= null");
shouldBeTrue("6 < '52'");
shouldBeTrue("6 < '72'"); // #36087
shouldBeFalse("NaN < 0");
shouldBeFalse("NaN <= 0");
shouldBeFalse("NaN > 0");
shouldBeFalse("NaN >= 0");
shouldBeFalse("nonSpeculativeLessEq('abc', 0)"); // #35246
shouldBeTrue("nonSpeculativeLessEq('', 0)");
shouldBeTrue("nonSpeculativeLessEq(' ', 0)");
shouldBeTrue("nonSpeculativeLessEq(null, 0)");
shouldBeFalse("nonSpeculativeLessEq(0, 'abc')");
shouldBeTrue("nonSpeculativeLessEq(0, '')");
shouldBeTrue("nonSpeculativeLessEq(0, null)");
shouldBeTrue("nonSpeculativeLessEq(null, null)");
shouldBeTrue("nonSpeculativeLess(6, '52')");
shouldBeTrue("nonSpeculativeLess(6, '72')"); // #36087
shouldBeFalse("nonSpeculativeLess(NaN, 0)");
shouldBeFalse("nonSpeculativeLessEq(NaN, 0)");
shouldBeFalse("nonSpeculativeGreater(NaN, 0)");
shouldBeFalse("nonSpeculativeGreaterEq(NaN, 0)");
// strict comparison ===
shouldBeFalse("0 === false");
//shouldBe("undefined === undefined", "true"); // aborts in IE5 (undefined is not defined ;)
shouldBeTrue("null === null");
shouldBeFalse("NaN === NaN");
shouldBeTrue("0.0 === 0");
shouldBeTrue("'abc' === 'abc'");
shouldBeFalse("'a' === 'x'");
shouldBeFalse("1 === '1'");
shouldBeFalse("'1' === 1");
shouldBeTrue("true === true");
shouldBeTrue("false === false");
shouldBeFalse("true === false");
shouldBeTrue("Math === Math");
shouldBeFalse("Math === Boolean");
shouldBeTrue("Infinity === Infinity");
// strict comparison ===
shouldBeFalse("nonSpeculativeStrictEqual(0, false)");
//shouldBe("undefined === undefined", "true"); // aborts in IE5 (undefined is not defined ;)
shouldBeTrue("nonSpeculativeStrictEqual(null, null)");
shouldBeFalse("nonSpeculativeStrictEqual(NaN, NaN)");
shouldBeTrue("nonSpeculativeStrictEqual(0.0, 0)");
shouldBeTrue("nonSpeculativeStrictEqual('abc', 'abc')");
shouldBeFalse("nonSpeculativeStrictEqual('a', 'x')");
shouldBeFalse("nonSpeculativeStrictEqual(1, '1')");
shouldBeFalse("nonSpeculativeStrictEqual('1', 1)");
shouldBeTrue("nonSpeculativeStrictEqual(true, true)");
shouldBeTrue("nonSpeculativeStrictEqual(false, false)");
shouldBeFalse("nonSpeculativeStrictEqual(true, false)");
shouldBeTrue("nonSpeculativeStrictEqual(Math, Math)");
shouldBeFalse("nonSpeculativeStrictEqual(Math, Boolean)");
shouldBeTrue("nonSpeculativeStrictEqual(Infinity, Infinity)");
// !==
shouldBe("0 !== 0", "false");
shouldBe("0 !== 1", "true");
// !==
shouldBe("nonSpeculativeStrictNotEqual(0, 0)", "false");
shouldBe("nonSpeculativeStrictNotEqual(0, 1)", "true");
shouldBe("typeof undefined", "'undefined'");
shouldBe("typeof null", "'object'");
shouldBe("typeof true", "'boolean'");
shouldBe("typeof false", "'boolean'");
shouldBe("typeof 1", "'number'");
shouldBe("typeof 'a'", "'string'");
shouldBe("typeof shouldBe", "'function'");
shouldBe("typeof Number.NaN", "'number'");
shouldBe("11 && 22", "22");
shouldBe("null && true", "null");
shouldBe("11 || 22", "11");
shouldBe("null || 'a'", "'a'");
shouldBeUndefined("void 1");
shouldBeTrue("1 in [1, 2]");
shouldBeFalse("3 in [1, 2]");
shouldBeTrue("'a' in { a:1, b:2 }");
// instanceof
// Those 2 lines don't parse in Netscape...
shouldBe("(new Boolean()) instanceof Boolean", "true");
shouldBe("(new Boolean()) instanceof Number", "false");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS function test() { return;}; lab: 1 is 1
PASS function test() { while(0) break; } lab: 1 is 1
PASS function test() { while(0) continue; } lab: 1 is 1
PASS function test() { return lab;} lab: 1 is 1
PASS function test() { while(0) break lab; } lab: 1 threw exception SyntaxError: Undefined label 'lab'.
PASS function test() { while(0) continue lab; } lab: 1 threw exception SyntaxError: Undefined label 'lab'.
PASS function test() { return } lab: 1 is 1
PASS function test() { while(0) break } lab: 1 is 1
PASS function test() { while(0) continue } lab: 1 is 1
PASS function test() { return 0 } lab: 1 is 1
PASS function test() { while(0) break lab } lab: 1 threw exception SyntaxError: Undefined label 'lab'.
PASS function test() { while(0) continue lab } lab: 1 threw exception SyntaxError: Undefined label 'lab'.
PASS var éĀʯΈᢨ = 101; éĀʯΈᢨ; is 101
PASS var f÷; threw exception SyntaxError: Unexpected token ILLEGAL.
PASS var \u0061 = 102; a is 102
PASS var f\u0030 = 103; f0 is 103
PASS var \u00E9\u0100\u02AF\u0388\u18A8 = 104; \u00E9\u0100\u02AF\u0388\u18A8; is 104
PASS var f\u00F7; threw exception SyntaxError: Unexpected token ILLEGAL.
PASS var \u0030; threw exception SyntaxError: Unexpected token ILLEGAL.
PASS var test = { }; test.i= 0; test.i\u002b= 1; test.i; threw exception SyntaxError: Unexpected token ILLEGAL.
PASS var test = { }; test.i= 0; test.i+= 1; test.i; is 1
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
// Check parsing of nested scopes; a couple of the break/continue to label cases are invalid.
shouldBe("function test() { return;}; lab: 1", "1");
shouldBe("function test() { while(0) break; } lab: 1", "1");
shouldBe("function test() { while(0) continue; } lab: 1", "1");
shouldBe("function test() { return lab;} lab: 1", "1");
shouldThrow("function test() { while(0) break lab; } lab: 1");
shouldThrow("function test() { while(0) continue lab; } lab: 1");
shouldBe("function test() { return } lab: 1", "1");
shouldBe("function test() { while(0) break } lab: 1", "1");
shouldBe("function test() { while(0) continue } lab: 1", "1");
shouldBe("function test() { return 0 } lab: 1", "1");
shouldThrow("function test() { while(0) break lab } lab: 1");
shouldThrow("function test() { while(0) continue lab } lab: 1");
a = 1
b = 123 // comment
c = 2
c = 3 /* comment */
d = 4
// non-ASCII identifier letters
shouldBe("var \u00E9\u0100\u02AF\u0388\u18A8 = 101; \u00E9\u0100\u02AF\u0388\u18A8;", "101");
// invalid identifier letters
shouldThrow("var f\xF7;");
// ASCII identifier characters as escape sequences
shouldBe("var \\u0061 = 102; a", "102");
shouldBe("var f\\u0030 = 103; f0", "103");
// non-ASCII identifier letters as escape sequences
shouldBe("var \\u00E9\\u0100\\u02AF\\u0388\\u18A8 = 104; \\u00E9\\u0100\\u02AF\\u0388\\u18A8;", "104");
// invalid identifier characters as escape sequences
shouldThrow("var f\\u00F7;");
shouldThrow("var \\u0030;");
shouldThrow("var test = { }; test.i= 0; test.i\\u002b= 1; test.i;");
shouldBe("var test = { }; test.i= 0; test.i\u002b= 1; test.i;", "1");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Object.prototype.length is undefined
PASS Function.prototype.length is 0
PASS Array.prototype.length is 0
PASS String.prototype.length is 0
PASS Boolean.prototype.length is undefined
PASS Number.prototype.length is undefined
PASS Date.prototype.length is undefined
PASS RegExp.prototype.length is undefined
PASS Error.prototype.length is undefined
PASS Array.prototype.length is 6
PASS Function.prototype.length is 0
PASS String.prototype.length is 0
PASS delete Array.prototype.length is false
PASS delete Function.prototype.length is false
PASS delete String.prototype.length is false
PASS foundArrayPrototypeLength is false
PASS foundFunctionPrototypeLength is false
PASS foundStringPrototypeLength is false
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
shouldBe("Object.prototype.length","undefined");
shouldBe("Function.prototype.length","0");
shouldBe("Array.prototype.length","0");
shouldBe("String.prototype.length","0");
shouldBe("Boolean.prototype.length","undefined");
shouldBe("Number.prototype.length","undefined");
shouldBe("Date.prototype.length","undefined");
shouldBe("RegExp.prototype.length","undefined");
shouldBe("Error.prototype.length","undefined");
// check !ReadOnly
Array.prototype.length = 6;
shouldBe("Array.prototype.length","6");
// check ReadOnly
Function.prototype.length = 7;
shouldBe("Function.prototype.length","0");
String.prototype.length = 8;
shouldBe("String.prototype.length","0");
// check DontDelete
shouldBe("delete Array.prototype.length","false");
shouldBe("delete Function.prototype.length","false");
shouldBe("delete String.prototype.length","false");
// check DontEnum
var foundArrayPrototypeLength = false;
for (i in Array.prototype) { if (i == "length") foundArrayPrototypeLength = true; }
shouldBe("foundArrayPrototypeLength","false");
var foundFunctionPrototypeLength = false;
for (i in Function.prototype) { if (i == "length") foundFunctionPrototypeLength = true; }
shouldBe("foundFunctionPrototypeLength","false");
var foundStringPrototypeLength = false;
for (i in String.prototype) { if (i == "length") foundStringPrototypeLength = true; }
shouldBe("foundStringPrototypeLength","false");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Object.prototype.__proto__ == Object.prototype is false
PASS Function.prototype.__proto__ is Object.prototype
PASS Array.prototype.__proto__ is Object.prototype
PASS String.prototype.__proto__ is Object.prototype
PASS Boolean.prototype.__proto__ is Object.prototype
PASS Number.prototype.__proto__ is Object.prototype
PASS Date.prototype.__proto__ is Object.prototype
PASS RegExp.prototype.__proto__ is Object.prototype
PASS Error.prototype.__proto__ is Object.prototype
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
shouldBe("Object.prototype.__proto__ == Object.prototype","false");
shouldBe("Function.prototype.__proto__","Object.prototype");
shouldBe("Array.prototype.__proto__","Object.prototype");
shouldBe("String.prototype.__proto__","Object.prototype");
shouldBe("Boolean.prototype.__proto__","Object.prototype");
shouldBe("Number.prototype.__proto__","Object.prototype");
shouldBe("Date.prototype.__proto__","Object.prototype");
shouldBe("RegExp.prototype.__proto__","Object.prototype");
shouldBe("Error.prototype.__proto__","Object.prototype");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS f(2) is 22
PASS OBJECT.toString() is 'hello'
PASS s is 'hello'
PASS g is 'foo'
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
var b = new Boolean();
b.x = 11;
with (b) {
f = function(a) { return a*x; } // remember scope chain
}
shouldBe("f(2)", "22");
var OBJECT = new MyObject( "hello" );
function MyObject(value) {
this.value = value;
this.toString = new Function( "return this.value+''" );
return this;
}
shouldBe("OBJECT.toString()", "'hello'");
var s;
with (OBJECT) {
s = toString();
}
shouldBe("s", "'hello'");
// Make sure that for ... in reevaluates the scoping every time!
P = { foo : 1, bar : 2, baz : 3 }
function testForIn() {
for (g in P) {
eval("var g;") //Change the scope of g half-ways through the loop
}
}
testForIn();
shouldBe("g", "'foo'"); //Before the eval, g was in outer scope, but not after!
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS testSwitch(0) is 'abcd'
PASS testSwitch(1) is 'bcd'
PASS testSwitch(2) is 'd'
PASS testSwitch(false) is ''
PASS testSwitch2(1) is 'a'
PASS testSwitch2(2) is 'b'
PASS testSwitch2(3) is 'd'
PASS testSwitch2(-1) is 'cd'
PASS testSwitch2('x') is 'cd'
PASS testSwitch3(0) is 'cde'
PASS testSwitch3(3) is 'de'
PASS testSwitch3(4) is 'e'
PASS testSwitch4(0) is 'ab'
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
function testSwitch(v) {
var result = "";
switch (v) {
case 0:
result += 'a';
case 1:
       result += 'b';
case 1:
result += 'c';
case 2:
result += 'd';
break;
}
return result;
}
shouldBe("testSwitch(0)", "'abcd'");
shouldBe("testSwitch(1)", "'bcd'"); // IE agrees, NS disagrees
shouldBe("testSwitch(2)", "'d'");
shouldBe("testSwitch(false)", "''");
function testSwitch2(v) {
var result = "";
switch (v) {
case 1:
result += 'a';
break;
case 2:
       result += 'b';
break;
default:
result += 'c';
case 3:
result += 'd';
break;
}
return result;
}
shouldBe("testSwitch2(1)", "'a'");
shouldBe("testSwitch2(2)", "'b'");
shouldBe("testSwitch2(3)", "'d'");
shouldBe("testSwitch2(-1)", "'cd'");
shouldBe("testSwitch2('x')", "'cd'");
function testSwitch3(v) {
var result = "";
switch (v) {
default:
result += 'c';
case 3:
result += 'd';
case 4:
result += 'e';
break;
}
return result;
};
shouldBe("testSwitch3(0)", "'cde'");
shouldBe("testSwitch3(3)", "'de'");
shouldBe("testSwitch3(4)", "'e'");
function testSwitch4(v) {
var result = "";
switch (v) {
case 0:
result += 'a';
result += 'b';
break;
}
return result;
};
shouldBe("testSwitch4(0)", "'ab'");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
KDE JS Test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS varInFunction() is true
PASS varInVarList() is true
PASS varListOrder() is true
PASS varInBlock() is true
PASS varInIf() is true
PASS varInElse() is true
PASS varInDoWhile() is true
PASS varInWhile() is true
PASS varInFor() is true
PASS varInForIn() is true
PASS varInWith() is true
PASS varInCase() is true
PASS varInLabel() is true
PASS varInCatch() is true
PASS varInFinally() is true
PASS varInTry() is true
PASS varInForInitExpr() is true
PASS varInSubFunction() is true
PASS varGlobal is 1
PASS overrideVar is 1
PASS overrideVar2 is 2
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
var myvar = 1;
function varInFunction() {
return (myvar == undefined);
var myvar = 2;
}
function varInVarList() {
return (myvar == undefined);
var a = 1, b = 0, myvar = 2;
}
function varListOrder() {
var tmp = 0;
var i = ++tmp, j = ++tmp;
return j == 2;
}
function varInBlock() {
return (myvar == undefined);
{
var myvar = 2;
}
}
function varInIf() {
return (myvar == undefined);
if (false)
var myvar = 2;
}
function varInElse() {
return (myvar == undefined);
if (true) {
}
else
var myvar = 2;
}
function varInDoWhile() {
return (myvar == undefined);
do
var myvar = 2;
while (false);
}
function varInWhile() {
return (myvar == undefined);
while (false)
var myvar = 2;
}
function varInFor() {
return (myvar == undefined);
var i;
for (i = 0; i < 0; i++)
var myvar = 2;
}
function varInForInitExpr() {
return (myvar == undefined);
for (var myvar = 2; i < 2; i++) {
}
}
function varInForIn() {
return (myvar == undefined);
var o = new Object();
var i;
for (i in o)
var myvar = 2;
}
function varInWith() {
return (myvar == undefined);
with (String)
var myvar = 2;
}
function varInCase() {
return (myvar == undefined);
switch (1) {
case 0:
var myvar = 2;
case 1:
}
}
function varInLabel() {
return (myvar == undefined);
label1:
var myvar = 2;
}
function varInCatch() {
return (myvar == undefined);
try {
}
catch (e) {
var myvar = 2;
}
}
function varInFinally() {
return (myvar == undefined);
try {
}
finally {
var myvar = 2;
}
}
function varInTry() {
return (myvar == undefined);
try {
var myvar = 2;
}
catch (e) {
}
finally {
}
}
function varInSubFunction() {
return (myvar == 1);
function subfunction() {
var myvar = 2;
}
}
if (!varGlobal)
var varGlobal = 1;
shouldBe("varInFunction()","true");
shouldBe("varInVarList()","true");
shouldBe("varListOrder()","true");
shouldBe("varInBlock()","true");
shouldBe("varInIf()","true");
shouldBe("varInElse()","true");
shouldBe("varInDoWhile()","true");
shouldBe("varInWhile()","true");
shouldBe("varInFor()","true");
shouldBe("varInForIn()","true");
shouldBe("varInWith()","true");
shouldBe("varInCase()","true");
shouldBe("varInLabel()","true");
shouldBe("varInCatch()","true");
shouldBe("varInFinally()","true");
shouldBe("varInTry()","true");
shouldBe("varInForInitExpr()","true");
shouldBe("varInSubFunction()","true");
shouldBe("varGlobal", "1");
var overrideVar = 1;
var overrideVar;
shouldBe("overrideVar", "1");
var overrideVar2 = 1;
var overrideVar2 = 2;
shouldBe("overrideVar2", "2");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This is a test case for String.prototype.anchor(name).
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS '_'.anchor('b') is "<a name=\"b\">_</a>"
PASS '<'.anchor('b') is "<a name=\"b\"><</a>"
PASS '_'.anchor(0x2A) is "<a name=\"42\">_</a>"
PASS '_'.anchor('"') is "<a name=\"&quot;\">_</a>"
PASS '_'.anchor('" href="http://www.evil.com') is "<a name=\"&quot; href=&quot;http://www.evil.com\">_</a>"
PASS String.prototype.anchor.call(0x2A, 0x2A) is "<a name=\"42\">42</a>"
FAIL String.prototype.anchor.call(undefined) should throw TypeError: Type error. Was <a name="undefined">undefined</a>.
FAIL String.prototype.anchor.call(null) should throw TypeError: Type error. Was <a name="undefined">null</a>.
PASS String.prototype.anchor.length is 1
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
'This is a test case for String.prototype.anchor(name).'
);
// This test is based on http://mathias.html5.org/tests/javascript/string/.
// Simple case.
shouldBe("'_'.anchor('b')", '"<a name=\\"b\\">_</a>"');
// Does not escape special characters in `this` value.
shouldBe("'<'.anchor('b')", '"<a name=\\"b\\"><</a>"');
// first argument gets ToString()ed.
shouldBe("'_'.anchor(0x2A)", '"<a name=\\"42\\">_</a>"');
// Check that the quotation mark is correctly escaped.
shouldBe("'_'.anchor('\"')", '"<a name=\\"&quot;\\">_</a>"');
shouldBe("'_'.anchor('\" href=\"http://www.evil.com')", '"<a name=\\"&quot; href=&quot;http://www.evil.com\\">_</a>"');
// Generic use on Number object.
shouldBe("String.prototype.anchor.call(0x2A, 0x2A)", '"<a name=\\"42\\">42</a>"');
// Generic use on non-coercible object `undefined`.
shouldThrow("String.prototype.anchor.call(undefined)", '"TypeError: Type error"');
// Generic use on non-coercible object `null`.
shouldThrow("String.prototype.anchor.call(null)", '"TypeError: Type error"');
// Check anchor.length.
shouldBe("String.prototype.anchor.length", "1");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This is a test case for String.prototype.fontcolor(color).
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS '_'.fontcolor('b') is "<font color=\"b\">_</font>"
PASS '<'.fontcolor('b') is "<font color=\"b\"><</font>"
PASS '_'.fontcolor(0x2A) is "<font color=\"42\">_</font>"
PASS '_'.fontcolor('"') is "<font color=\"&quot;\">_</font>"
PASS '_'.fontcolor('" size="2px') is "<font color=\"&quot; size=&quot;2px\">_</font>"
PASS String.prototype.fontcolor.call(0x2A, 0x2A) is "<font color=\"42\">42</font>"
FAIL String.prototype.fontcolor.call(undefined) should throw TypeError: Type error. Was <font color="undefined">undefined</font>.
FAIL String.prototype.fontcolor.call(null) should throw TypeError: Type error. Was <font color="undefined">null</font>.
PASS String.prototype.fontcolor.length is 1
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
'This is a test case for String.prototype.fontcolor(color).'
);
// This test is based on http://mathias.html5.org/tests/javascript/string/.
// Simple case.
shouldBe("'_'.fontcolor('b')", '"<font color=\\"b\\">_</font>"');
// Does not escape special characters in `this` value.
shouldBe("'<'.fontcolor('b')", '"<font color=\\"b\\"><</font>"');
// First argument gets ToString()ed.
shouldBe("'_'.fontcolor(0x2A)", '"<font color=\\"42\\">_</font>"');
// Check that the quotation mark is correctly escaped.
shouldBe("'_'.fontcolor('\"')", '"<font color=\\"&quot;\\">_</font>"');
shouldBe("'_'.fontcolor('\" size=\"2px')", '"<font color=\\"&quot; size=&quot;2px\\">_</font>"');
// Generic use on Number object.
shouldBe("String.prototype.fontcolor.call(0x2A, 0x2A)", '"<font color=\\"42\\">42</font>"');
// Generic use on non-coercible object `undefined`.
shouldThrow("String.prototype.fontcolor.call(undefined)", '"TypeError: Type error"');
// Generic use on non-coercible object `null`.
shouldThrow("String.prototype.fontcolor.call(null)", '"TypeError: Type error"');
// Check fontcolor.length.
shouldBe("String.prototype.fontcolor.length", "1");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This is a test case for String.prototype.fontsize(size).
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS '_'.fontsize('"') is "<font size=\"&quot;\">_</font>"
PASS '_'.fontsize('b') is "<font size=\"b\">_</font>"
PASS '<'.fontsize('b') is "<font size=\"b\"><</font>"
PASS '_'.fontsize(0x2A) is "<font size=\"42\">_</font>"
PASS '_'.fontsize('"') is "<font size=\"&quot;\">_</font>"
PASS '_'.fontsize('" color="b') is "<font size=\"&quot; color=&quot;b\">_</font>"
PASS String.prototype.fontsize.call(0x2A, 0x2A) is "<font size=\"42\">42</font>"
FAIL String.prototype.fontsize.call(undefined) should throw TypeError: Type error. Was <font size="undefined">undefined</font>.
FAIL String.prototype.fontsize.call(null) should throw TypeError: Type error. Was <font size="undefined">null</font>.
PASS String.prototype.fontsize.length is 1
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
'This is a test case for String.prototype.fontsize(size).'
);
// This test is based on http://mathias.html5.org/tests/javascript/string/.
// Check that the quotation mark is correctly escaped.
shouldBe("'_'.fontsize('\"')", '"<font size=\\"&quot;\\">_</font>"');
// Simple case.
shouldBe("'_'.fontsize('b')", '"<font size=\\"b\\">_</font>"');
// Does not escape special characters in `this` value.
shouldBe("'<'.fontsize('b')", '"<font size=\\"b\\"><</font>"');
// First argument gets ToString()ed.
shouldBe("'_'.fontsize(0x2A)", '"<font size=\\"42\\">_</font>"');
// Check that the quotation mark is correctly escaped.
shouldBe("'_'.fontsize('\"')", '"<font size=\\"&quot;\\">_</font>"');
shouldBe("'_'.fontsize('\" color=\"b')", '"<font size=\\"&quot; color=&quot;b\\">_</font>"');
// Generic use on Number object.
shouldBe("String.prototype.fontsize.call(0x2A, 0x2A)", '"<font size=\\"42\\">42</font>"');
// Generic use on non-coercible object `undefined`.
shouldThrow("String.prototype.fontsize.call(undefined)", '"TypeError: Type error"');
// Generic use on non-coercible object `null`.
shouldThrow("String.prototype.fontsize.call(null)", '"TypeError: Type error"');
// Check fontsize.length.
shouldBe("String.prototype.fontsize.length", "1");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This is a test case for String.prototype.link(href).
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS '_'.link('"') is "<a href=\"&quot;\">_</a>"
PASS '_'.link('b') is "<a href=\"b\">_</a>"
PASS '<'.link('b') is "<a href=\"b\"><</a>"
PASS '_'.link(0x2A) is "<a href=\"42\">_</a>"
PASS '_'.link('"') is "<a href=\"&quot;\">_</a>"
PASS '_'.link('" target="_blank') is "<a href=\"&quot; target=&quot;_blank\">_</a>"
PASS String.prototype.link.call(0x2A, 0x2A) is "<a href=\"42\">42</a>"
FAIL String.prototype.link.call(undefined) should throw TypeError: Type error. Was <a href="undefined">undefined</a>.
FAIL String.prototype.link.call(null) should throw TypeError: Type error. Was <a href="undefined">null</a>.
PASS String.prototype.link.length is 1
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
'This is a test case for String.prototype.link(href).'
);
// This test is based on http://mathias.html5.org/tests/javascript/string/.
// Check that the quotation mark is correctly escaped.
shouldBe("'_'.link('\"')", '"<a href=\\"&quot;\\">_</a>"');
// Simple case.
shouldBe("'_'.link('b')", '"<a href=\\"b\\">_</a>"');
// Does not escape special characters in `this` value.
shouldBe("'<'.link('b')", '"<a href=\\"b\\"><</a>"');
// First argument gets ToString()ed.
shouldBe("'_'.link(0x2A)", '"<a href=\\"42\\">_</a>"');
// Check that the quotation mark is correctly escaped.
shouldBe("'_'.link('\"')", '"<a href=\\"&quot;\\">_</a>"');
shouldBe("'_'.link('\" target=\"_blank')", '"<a href=\\"&quot; target=&quot;_blank\\">_</a>"');
// Generic use on Number object.
shouldBe("String.prototype.link.call(0x2A, 0x2A)", '"<a href=\\"42\\">42</a>"');
// Generic use on non-coercible object `undefined`.
shouldThrow("String.prototype.link.call(undefined)", '"TypeError: Type error"');
// Generic use on non-coercible object `null`.
shouldThrow("String.prototype.link.call(null)", '"TypeError: Type error"');
// Check link.length.
shouldBe("String.prototype.link.length", "1");
\ No newline at end of file
# Copyright 2013 the V8 project authors. All rights reserved.
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Test the conversion performed by the function Number.prototype.toString.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Number(0).toString() is "0"
PASS Number.prototype.toString.call(0) is "0"
PASS Number.prototype.toString.call(new Number(0)) is "0"
PASS Number("0").toString() is "0"
PASS Number(0).toString(10) is "0"
PASS Number(0).toString(2) is "0"
PASS Number.prototype.toString.call(0, 2) is "0"
PASS Number.prototype.toString.call(new Number(0), 2) is "0"
PASS Number(0).toString(36) is "0"
PASS Number.prototype.toString.call(0, 36) is "0"
PASS Number.prototype.toString.call(new Number(0), 36) is "0"
PASS Number(-1).toString() is "-1"
PASS Number.prototype.toString.call(-1) is "-1"
PASS Number.prototype.toString.call(new Number(-1)) is "-1"
PASS Number("-1").toString() is "-1"
PASS Number(-1).toString(10) is "-1"
PASS Number(-1).toString(2) is "-1"
PASS Number.prototype.toString.call(-1, 2) is "-1"
PASS Number.prototype.toString.call(new Number(-1), 2) is "-1"
PASS Number(-1).toString(36) is "-1"
PASS Number.prototype.toString.call(-1, 36) is "-1"
PASS Number.prototype.toString.call(new Number(-1), 36) is "-1"
PASS Number(1).toString() is "1"
PASS Number.prototype.toString.call(1) is "1"
PASS Number.prototype.toString.call(new Number(1)) is "1"
PASS Number("1").toString() is "1"
PASS Number(1).toString(10) is "1"
PASS Number(1).toString(2) is "1"
PASS Number.prototype.toString.call(1, 2) is "1"
PASS Number.prototype.toString.call(new Number(1), 2) is "1"
PASS Number(1).toString(36) is "1"
PASS Number.prototype.toString.call(1, 36) is "1"
PASS Number.prototype.toString.call(new Number(1), 36) is "1"
PASS Number(1984).toString() is "1984"
PASS Number.prototype.toString.call(1984) is "1984"
PASS Number.prototype.toString.call(new Number(1984)) is "1984"
PASS Number("1984").toString() is "1984"
PASS Number(1984).toString(10) is "1984"
PASS Number(1984).toString(2) is "11111000000"
PASS Number.prototype.toString.call(1984, 2) is "11111000000"
PASS Number.prototype.toString.call(new Number(1984), 2) is "11111000000"
PASS Number(1984).toString(36) is "1j4"
PASS Number.prototype.toString.call(1984, 36) is "1j4"
PASS Number.prototype.toString.call(new Number(1984), 36) is "1j4"
PASS Number(-1984).toString() is "-1984"
PASS Number.prototype.toString.call(-1984) is "-1984"
PASS Number.prototype.toString.call(new Number(-1984)) is "-1984"
PASS Number("-1984").toString() is "-1984"
PASS Number(-1984).toString(10) is "-1984"
PASS Number(-1984).toString(2) is "-11111000000"
PASS Number.prototype.toString.call(-1984, 2) is "-11111000000"
PASS Number.prototype.toString.call(new Number(-1984), 2) is "-11111000000"
PASS Number(-1984).toString(36) is "-1j4"
PASS Number.prototype.toString.call(-1984, 36) is "-1j4"
PASS Number.prototype.toString.call(new Number(-1984), 36) is "-1j4"
PASS Number(2147483647).toString() is "2147483647"
PASS Number.prototype.toString.call(2147483647) is "2147483647"
PASS Number.prototype.toString.call(new Number(2147483647)) is "2147483647"
PASS Number("2147483647").toString() is "2147483647"
PASS Number(2147483647).toString(10) is "2147483647"
PASS Number(2147483647).toString(2) is "1111111111111111111111111111111"
PASS Number.prototype.toString.call(2147483647, 2) is "1111111111111111111111111111111"
PASS Number.prototype.toString.call(new Number(2147483647), 2) is "1111111111111111111111111111111"
PASS Number(2147483647).toString(36) is "zik0zj"
PASS Number.prototype.toString.call(2147483647, 36) is "zik0zj"
PASS Number.prototype.toString.call(new Number(2147483647), 36) is "zik0zj"
PASS Number(-2147483648).toString() is "-2147483648"
PASS Number.prototype.toString.call(-2147483648) is "-2147483648"
PASS Number.prototype.toString.call(new Number(-2147483648)) is "-2147483648"
PASS Number("-2147483648").toString() is "-2147483648"
PASS Number(-2147483648).toString(10) is "-2147483648"
PASS Number(-2147483648).toString(2) is "-10000000000000000000000000000000"
PASS Number.prototype.toString.call(-2147483648, 2) is "-10000000000000000000000000000000"
PASS Number.prototype.toString.call(new Number(-2147483648), 2) is "-10000000000000000000000000000000"
PASS Number(-2147483648).toString(36) is "-zik0zk"
PASS Number.prototype.toString.call(-2147483648, 36) is "-zik0zk"
PASS Number.prototype.toString.call(new Number(-2147483648), 36) is "-zik0zk"
PASS Number(9007199254740992).toString() is "9007199254740992"
PASS Number.prototype.toString.call(9007199254740992) is "9007199254740992"
PASS Number.prototype.toString.call(new Number(9007199254740992)) is "9007199254740992"
PASS Number("9007199254740992").toString() is "9007199254740992"
PASS Number(9007199254740992).toString(10) is "9007199254740992"
PASS Number(9007199254740992).toString(2) is "100000000000000000000000000000000000000000000000000000"
PASS Number.prototype.toString.call(9007199254740992, 2) is "100000000000000000000000000000000000000000000000000000"
PASS Number.prototype.toString.call(new Number(9007199254740992), 2) is "100000000000000000000000000000000000000000000000000000"
PASS Number(9007199254740992).toString(36) is "2gosa7pa2gw"
PASS Number.prototype.toString.call(9007199254740992, 36) is "2gosa7pa2gw"
PASS Number.prototype.toString.call(new Number(9007199254740992), 36) is "2gosa7pa2gw"
PASS Number(-9007199254740992).toString() is "-9007199254740992"
PASS Number.prototype.toString.call(-9007199254740992) is "-9007199254740992"
PASS Number.prototype.toString.call(new Number(-9007199254740992)) is "-9007199254740992"
PASS Number("-9007199254740992").toString() is "-9007199254740992"
PASS Number(-9007199254740992).toString(10) is "-9007199254740992"
PASS Number(-9007199254740992).toString(2) is "-100000000000000000000000000000000000000000000000000000"
PASS Number.prototype.toString.call(-9007199254740992, 2) is "-100000000000000000000000000000000000000000000000000000"
PASS Number.prototype.toString.call(new Number(-9007199254740992), 2) is "-100000000000000000000000000000000000000000000000000000"
PASS Number(-9007199254740992).toString(36) is "-2gosa7pa2gw"
PASS Number.prototype.toString.call(-9007199254740992, 36) is "-2gosa7pa2gw"
PASS Number.prototype.toString.call(new Number(-9007199254740992), 36) is "-2gosa7pa2gw"
PASS Number(0).toString() is "0"
PASS Number.prototype.toString.call(0) is "0"
PASS Number.prototype.toString.call(new Number(0)) is "0"
PASS Number("0").toString() is "0"
PASS Number(0).toString(10) is "0"
PASS Number(0).toString(2) is "0"
PASS Number.prototype.toString.call(0, 2) is "0"
PASS Number.prototype.toString.call(new Number(0), 2) is "0"
PASS Number(0).toString(36) is "0"
PASS Number.prototype.toString.call(0, 36) is "0"
PASS Number.prototype.toString.call(new Number(0), 36) is "0"
PASS Number(-1).toString() is "-1"
PASS Number.prototype.toString.call(-1) is "-1"
PASS Number.prototype.toString.call(new Number(-1)) is "-1"
PASS Number("-1").toString() is "-1"
PASS Number(-1).toString(10) is "-1"
PASS Number(-1).toString(2) is "-1"
PASS Number.prototype.toString.call(-1, 2) is "-1"
PASS Number.prototype.toString.call(new Number(-1), 2) is "-1"
PASS Number(-1).toString(36) is "-1"
PASS Number.prototype.toString.call(-1, 36) is "-1"
PASS Number.prototype.toString.call(new Number(-1), 36) is "-1"
PASS Number(1).toString() is "1"
PASS Number.prototype.toString.call(1) is "1"
PASS Number.prototype.toString.call(new Number(1)) is "1"
PASS Number("1").toString() is "1"
PASS Number(1).toString(10) is "1"
PASS Number(1).toString(2) is "1"
PASS Number.prototype.toString.call(1, 2) is "1"
PASS Number.prototype.toString.call(new Number(1), 2) is "1"
PASS Number(1).toString(36) is "1"
PASS Number.prototype.toString.call(1, 36) is "1"
PASS Number.prototype.toString.call(new Number(1), 36) is "1"
PASS Number(1984).toString() is "1984"
PASS Number.prototype.toString.call(1984) is "1984"
PASS Number.prototype.toString.call(new Number(1984)) is "1984"
PASS Number("1984").toString() is "1984"
PASS Number(1984).toString(10) is "1984"
PASS Number(1984).toString(2) is "11111000000"
PASS Number.prototype.toString.call(1984, 2) is "11111000000"
PASS Number.prototype.toString.call(new Number(1984), 2) is "11111000000"
PASS Number(1984).toString(36) is "1j4"
PASS Number.prototype.toString.call(1984, 36) is "1j4"
PASS Number.prototype.toString.call(new Number(1984), 36) is "1j4"
PASS Number(-1984).toString() is "-1984"
PASS Number.prototype.toString.call(-1984) is "-1984"
PASS Number.prototype.toString.call(new Number(-1984)) is "-1984"
PASS Number("-1984").toString() is "-1984"
PASS Number(-1984).toString(10) is "-1984"
PASS Number(-1984).toString(2) is "-11111000000"
PASS Number.prototype.toString.call(-1984, 2) is "-11111000000"
PASS Number.prototype.toString.call(new Number(-1984), 2) is "-11111000000"
PASS Number(-1984).toString(36) is "-1j4"
PASS Number.prototype.toString.call(-1984, 36) is "-1j4"
PASS Number.prototype.toString.call(new Number(-1984), 36) is "-1j4"
PASS Number(2147483647).toString() is "2147483647"
PASS Number.prototype.toString.call(2147483647) is "2147483647"
PASS Number.prototype.toString.call(new Number(2147483647)) is "2147483647"
PASS Number("2147483647").toString() is "2147483647"
PASS Number(2147483647).toString(10) is "2147483647"
PASS Number(2147483647).toString(2) is "1111111111111111111111111111111"
PASS Number.prototype.toString.call(2147483647, 2) is "1111111111111111111111111111111"
PASS Number.prototype.toString.call(new Number(2147483647), 2) is "1111111111111111111111111111111"
PASS Number(2147483647).toString(36) is "zik0zj"
PASS Number.prototype.toString.call(2147483647, 36) is "zik0zj"
PASS Number.prototype.toString.call(new Number(2147483647), 36) is "zik0zj"
PASS Number(-2147483648).toString() is "-2147483648"
PASS Number.prototype.toString.call(-2147483648) is "-2147483648"
PASS Number.prototype.toString.call(new Number(-2147483648)) is "-2147483648"
PASS Number("-2147483648").toString() is "-2147483648"
PASS Number(-2147483648).toString(10) is "-2147483648"
PASS Number(-2147483648).toString(2) is "-10000000000000000000000000000000"
PASS Number.prototype.toString.call(-2147483648, 2) is "-10000000000000000000000000000000"
PASS Number.prototype.toString.call(new Number(-2147483648), 2) is "-10000000000000000000000000000000"
PASS Number(-2147483648).toString(36) is "-zik0zk"
PASS Number.prototype.toString.call(-2147483648, 36) is "-zik0zk"
PASS Number.prototype.toString.call(new Number(-2147483648), 36) is "-zik0zk"
PASS Number(9007199254740992).toString() is "9007199254740992"
PASS Number.prototype.toString.call(9007199254740992) is "9007199254740992"
PASS Number.prototype.toString.call(new Number(9007199254740992)) is "9007199254740992"
PASS Number("9007199254740992").toString() is "9007199254740992"
PASS Number(9007199254740992).toString(10) is "9007199254740992"
PASS Number(9007199254740992).toString(2) is "100000000000000000000000000000000000000000000000000000"
PASS Number.prototype.toString.call(9007199254740992, 2) is "100000000000000000000000000000000000000000000000000000"
PASS Number.prototype.toString.call(new Number(9007199254740992), 2) is "100000000000000000000000000000000000000000000000000000"
PASS Number(9007199254740992).toString(36) is "2gosa7pa2gw"
PASS Number.prototype.toString.call(9007199254740992, 36) is "2gosa7pa2gw"
PASS Number.prototype.toString.call(new Number(9007199254740992), 36) is "2gosa7pa2gw"
PASS Number(-9007199254740992).toString() is "-9007199254740992"
PASS Number.prototype.toString.call(-9007199254740992) is "-9007199254740992"
PASS Number.prototype.toString.call(new Number(-9007199254740992)) is "-9007199254740992"
PASS Number("-9007199254740992").toString() is "-9007199254740992"
PASS Number(-9007199254740992).toString(10) is "-9007199254740992"
PASS Number(-9007199254740992).toString(2) is "-100000000000000000000000000000000000000000000000000000"
PASS Number.prototype.toString.call(-9007199254740992, 2) is "-100000000000000000000000000000000000000000000000000000"
PASS Number.prototype.toString.call(new Number(-9007199254740992), 2) is "-100000000000000000000000000000000000000000000000000000"
PASS Number(-9007199254740992).toString(36) is "-2gosa7pa2gw"
PASS Number.prototype.toString.call(-9007199254740992, 36) is "-2gosa7pa2gw"
PASS Number.prototype.toString.call(new Number(-9007199254740992), 36) is "-2gosa7pa2gw"
PASS Number(0.1).toString() is "0.1"
PASS Number.prototype.toString.call(0.1) is "0.1"
PASS Number.prototype.toString.call(new Number(0.1)) is "0.1"
PASS Number("0.1").toString() is "0.1"
PASS Number(0.1).toString(10) is "0.1"
PASS Number(0.1).toString(2) is "0.0001100110011001100110011001100110011001100110011001101"
PASS Number.prototype.toString.call(0.1, 2) is "0.0001100110011001100110011001100110011001100110011001101"
PASS Number.prototype.toString.call(new Number(0.1), 2) is "0.0001100110011001100110011001100110011001100110011001101"
FAIL Number(0.1).toString(36) should be 0.3lllllllllm. Was 0.3llllllllllqsn8td1p464unmi.
FAIL Number.prototype.toString.call(0.1, 36) should be 0.3lllllllllm. Was 0.3llllllllllqsn8td1p464unmi.
FAIL Number.prototype.toString.call(new Number(0.1), 36) should be 0.3lllllllllm. Was 0.3llllllllllqsn8td1p464unmi.
PASS Number(-1.1).toString() is "-1.1"
PASS Number.prototype.toString.call(-1.1) is "-1.1"
PASS Number.prototype.toString.call(new Number(-1.1)) is "-1.1"
PASS Number("-1.1").toString() is "-1.1"
PASS Number(-1.1).toString(10) is "-1.1"
PASS Number(-1.1).toString(2) is "-1.000110011001100110011001100110011001100110011001101"
PASS Number.prototype.toString.call(-1.1, 2) is "-1.000110011001100110011001100110011001100110011001101"
PASS Number.prototype.toString.call(new Number(-1.1), 2) is "-1.000110011001100110011001100110011001100110011001101"
FAIL Number(-1.1).toString(36) should be -1.3llllllllm. Was -1.3lllllllllxagau2ctidswz5mi.
FAIL Number.prototype.toString.call(-1.1, 36) should be -1.3llllllllm. Was -1.3lllllllllxagau2ctidswz5mi.
FAIL Number.prototype.toString.call(new Number(-1.1), 36) should be -1.3llllllllm. Was -1.3lllllllllxagau2ctidswz5mi.
PASS Number(1.1).toString() is "1.1"
PASS Number.prototype.toString.call(1.1) is "1.1"
PASS Number.prototype.toString.call(new Number(1.1)) is "1.1"
PASS Number("1.1").toString() is "1.1"
PASS Number(1.1).toString(10) is "1.1"
PASS Number(1.1).toString(2) is "1.000110011001100110011001100110011001100110011001101"
PASS Number.prototype.toString.call(1.1, 2) is "1.000110011001100110011001100110011001100110011001101"
PASS Number.prototype.toString.call(new Number(1.1), 2) is "1.000110011001100110011001100110011001100110011001101"
FAIL Number(1.1).toString(36) should be 1.3llllllllm. Was 1.3lllllllllxagau2ctidswz5mi.
FAIL Number.prototype.toString.call(1.1, 36) should be 1.3llllllllm. Was 1.3lllllllllxagau2ctidswz5mi.
FAIL Number.prototype.toString.call(new Number(1.1), 36) should be 1.3llllllllm. Was 1.3lllllllllxagau2ctidswz5mi.
PASS Number(1984.1).toString() is "1984.1"
PASS Number.prototype.toString.call(1984.1) is "1984.1"
PASS Number.prototype.toString.call(new Number(1984.1)) is "1984.1"
PASS Number("1984.1").toString() is "1984.1"
PASS Number(1984.1).toString(10) is "1984.1"
PASS Number(1984.1).toString(2) is "11111000000.00011001100110011001100110011001100110011"
PASS Number.prototype.toString.call(1984.1, 2) is "11111000000.00011001100110011001100110011001100110011"
PASS Number.prototype.toString.call(new Number(1984.1), 2) is "11111000000.00011001100110011001100110011001100110011"
FAIL Number(1984.1).toString(36) should be 1j4.3lllllllc. Was 1j4.3lllllllcd2obsszcl3di.
FAIL Number.prototype.toString.call(1984.1, 36) should be 1j4.3lllllllc. Was 1j4.3lllllllcd2obsszcl3di.
FAIL Number.prototype.toString.call(new Number(1984.1), 36) should be 1j4.3lllllllc. Was 1j4.3lllllllcd2obsszcl3di.
PASS Number(-1984.1).toString() is "-1984.1"
PASS Number.prototype.toString.call(-1984.1) is "-1984.1"
PASS Number.prototype.toString.call(new Number(-1984.1)) is "-1984.1"
PASS Number("-1984.1").toString() is "-1984.1"
PASS Number(-1984.1).toString(10) is "-1984.1"
PASS Number(-1984.1).toString(2) is "-11111000000.00011001100110011001100110011001100110011"
PASS Number.prototype.toString.call(-1984.1, 2) is "-11111000000.00011001100110011001100110011001100110011"
PASS Number.prototype.toString.call(new Number(-1984.1), 2) is "-11111000000.00011001100110011001100110011001100110011"
FAIL Number(-1984.1).toString(36) should be -1j4.3lllllllc. Was -1j4.3lllllllcd2obsszcl3di.
FAIL Number.prototype.toString.call(-1984.1, 36) should be -1j4.3lllllllc. Was -1j4.3lllllllcd2obsszcl3di.
FAIL Number.prototype.toString.call(new Number(-1984.1), 36) should be -1j4.3lllllllc. Was -1j4.3lllllllcd2obsszcl3di.
PASS Number(2147483647.1).toString() is "2147483647.1"
PASS Number.prototype.toString.call(2147483647.1) is "2147483647.1"
PASS Number.prototype.toString.call(new Number(2147483647.1)) is "2147483647.1"
PASS Number("2147483647.1").toString() is "2147483647.1"
PASS Number(2147483647.1).toString(10) is "2147483647.1"
PASS Number(2147483647.1).toString(2) is "1111111111111111111111111111111.000110011001100110011"
PASS Number.prototype.toString.call(2147483647.1, 2) is "1111111111111111111111111111111.000110011001100110011"
PASS Number.prototype.toString.call(new Number(2147483647.1), 2) is "1111111111111111111111111111111.000110011001100110011"
FAIL Number(2147483647.1).toString(36) should be zik0zj.3lllg. Was zik0zj.3lllfu07ldi.
FAIL Number.prototype.toString.call(2147483647.1, 36) should be zik0zj.3lllg. Was zik0zj.3lllfu07ldi.
FAIL Number.prototype.toString.call(new Number(2147483647.1), 36) should be zik0zj.3lllg. Was zik0zj.3lllfu07ldi.
PASS Number(-2147483648.1).toString() is "-2147483648.1"
PASS Number.prototype.toString.call(-2147483648.1) is "-2147483648.1"
PASS Number.prototype.toString.call(new Number(-2147483648.1)) is "-2147483648.1"
PASS Number("-2147483648.1").toString() is "-2147483648.1"
PASS Number(-2147483648.1).toString(10) is "-2147483648.1"
PASS Number(-2147483648.1).toString(2) is "-10000000000000000000000000000000.000110011001100110011"
PASS Number.prototype.toString.call(-2147483648.1, 2) is "-10000000000000000000000000000000.000110011001100110011"
PASS Number.prototype.toString.call(new Number(-2147483648.1), 2) is "-10000000000000000000000000000000.000110011001100110011"
FAIL Number(-2147483648.1).toString(36) should be -zik0zk.3lllg. Was -zik0zk.3lllfu07ldi.
FAIL Number.prototype.toString.call(-2147483648.1, 36) should be -zik0zk.3lllg. Was -zik0zk.3lllfu07ldi.
FAIL Number.prototype.toString.call(new Number(-2147483648.1), 36) should be -zik0zk.3lllg. Was -zik0zk.3lllfu07ldi.
PASS Number(9007199254740992).toString() is "9007199254740992"
PASS Number.prototype.toString.call(9007199254740992) is "9007199254740992"
PASS Number.prototype.toString.call(new Number(9007199254740992)) is "9007199254740992"
PASS Number("9007199254740992").toString() is "9007199254740992"
PASS Number(9007199254740992).toString(10) is "9007199254740992"
PASS Number(9007199254740992).toString(2) is "100000000000000000000000000000000000000000000000000000"
PASS Number.prototype.toString.call(9007199254740992, 2) is "100000000000000000000000000000000000000000000000000000"
PASS Number.prototype.toString.call(new Number(9007199254740992), 2) is "100000000000000000000000000000000000000000000000000000"
PASS Number(9007199254740992).toString(36) is "2gosa7pa2gw"
PASS Number.prototype.toString.call(9007199254740992, 36) is "2gosa7pa2gw"
PASS Number.prototype.toString.call(new Number(9007199254740992), 36) is "2gosa7pa2gw"
PASS Number(-9007199254740992).toString() is "-9007199254740992"
PASS Number.prototype.toString.call(-9007199254740992) is "-9007199254740992"
PASS Number.prototype.toString.call(new Number(-9007199254740992)) is "-9007199254740992"
PASS Number("-9007199254740992").toString() is "-9007199254740992"
PASS Number(-9007199254740992).toString(10) is "-9007199254740992"
PASS Number(-9007199254740992).toString(2) is "-100000000000000000000000000000000000000000000000000000"
PASS Number.prototype.toString.call(-9007199254740992, 2) is "-100000000000000000000000000000000000000000000000000000"
PASS Number.prototype.toString.call(new Number(-9007199254740992), 2) is "-100000000000000000000000000000000000000000000000000000"
PASS Number(-9007199254740992).toString(36) is "-2gosa7pa2gw"
PASS Number.prototype.toString.call(-9007199254740992, 36) is "-2gosa7pa2gw"
PASS Number.prototype.toString.call(new Number(-9007199254740992), 36) is "-2gosa7pa2gw"
PASS successfullyParsed is true
TEST COMPLETE
// Copyright 2013 the V8 project authors. All rights reserved.
// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("Test the conversion performed by the function Number.prototype.toString.");
var numberIndex = 0;
var base10StringIndex = 1;
var base2StringIndex = 2;
var base36StringIndex = 3;
var validNumberData = [
// Regular Integers:
[0, '0', '0', '0'],
[-1, '-1', '-1', '-1'],
[1, '1', '1', '1'],
[1984, '1984', '11111000000', '1j4'],
[-1984, '-1984', '-11111000000', '-1j4'],
// Limits:
[2147483647, '2147483647', '1111111111111111111111111111111', 'zik0zj'], // INT_MAX.
[-2147483648, '-2147483648', '-10000000000000000000000000000000', '-zik0zk'], // INT_MIN
[9007199254740992, '9007199254740992', '100000000000000000000000000000000000000000000000000000', '2gosa7pa2gw'], // Max Integer in a double.
[-9007199254740992, '-9007199254740992', '-100000000000000000000000000000000000000000000000000000', '-2gosa7pa2gw'], // Min Integer in a double.
// Integers represented as double.
[0.0, '0', '0', '0'],
[-1.0, '-1', '-1', '-1'],
[1.0, '1', '1', '1'],
[1984.0, '1984', '11111000000', '1j4'],
[-1984.0, '-1984', '-11111000000', '-1j4'],
// Limits:
[2147483647.0, '2147483647', '1111111111111111111111111111111', 'zik0zj'], // INT_MAX.
[-2147483648.0, '-2147483648', '-10000000000000000000000000000000', '-zik0zk'], // INT_MIN
[9007199254740992.0, '9007199254740992', '100000000000000000000000000000000000000000000000000000', '2gosa7pa2gw'], // Max Integer in a double.
[-9007199254740992.0, '-9007199254740992', '-100000000000000000000000000000000000000000000000000000', '-2gosa7pa2gw'], // Min Integer in a double.
// Double.
[0.1, '0.1', '0.0001100110011001100110011001100110011001100110011001101', '0.3lllllllllm'],
[-1.1, '-1.1', '-1.000110011001100110011001100110011001100110011001101', '-1.3llllllllm'],
[1.1, '1.1', '1.000110011001100110011001100110011001100110011001101', '1.3llllllllm'],
[1984.1, '1984.1', '11111000000.00011001100110011001100110011001100110011', '1j4.3lllllllc'],
[-1984.1, '-1984.1', '-11111000000.00011001100110011001100110011001100110011', '-1j4.3lllllllc'],
// Limits:
[2147483647.1, '2147483647.1', '1111111111111111111111111111111.000110011001100110011', 'zik0zj.3lllg'],
[-2147483648.1, '-2147483648.1', '-10000000000000000000000000000000.000110011001100110011', '-zik0zk.3lllg'],
[9007199254740992.1, '9007199254740992', '100000000000000000000000000000000000000000000000000000', '2gosa7pa2gw'],
[-9007199254740992.1, '-9007199254740992', '-100000000000000000000000000000000000000000000000000000', '-2gosa7pa2gw'],
];
for (var i = 0; i < validNumberData.length; ++i) {
number = validNumberData[i][numberIndex];
// Base 10:
stringBase10 = validNumberData[i][base10StringIndex];
shouldBeEqualToString('Number(' + number + ').toString()', stringBase10);
shouldBeEqualToString('Number.prototype.toString.call(' + number + ')', stringBase10);
shouldBeEqualToString('Number.prototype.toString.call(new Number(' + number + '))', stringBase10);
// Passing the string to number should also lead to valid conversion.
shouldBeEqualToString('Number("' + number + '").toString()', stringBase10);
// Passing the base explicitly.
shouldBeEqualToString('Number(' + number + ').toString(10)', stringBase10);
// Base 2:
stringBase2 = validNumberData[i][base2StringIndex];
shouldBeEqualToString('Number(' + number + ').toString(2)', stringBase2);
shouldBeEqualToString('Number.prototype.toString.call(' + number + ', 2)', stringBase2);
shouldBeEqualToString('Number.prototype.toString.call(new Number(' + number + '), 2)', stringBase2);
// Base 36:
stringBase36 = validNumberData[i][base36StringIndex];
shouldBeEqualToString('Number(' + number + ').toString(36)', stringBase36);
shouldBeEqualToString('Number.prototype.toString.call(' + number + ', 36)', stringBase36);
shouldBeEqualToString('Number.prototype.toString.call(new Number(' + number + '), 36)', stringBase36);
}
successfullyParsed = true;
\ No newline at end of file
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