} } // namespace v8::internal
#endif // V8_ALLOCATION_TRACKER_H_
-
}
SetUpArrayBuffer();
-
-
intptr_t HeapObjectTagMask() { return kHeapObjectTagMask; }
} } // namespace v8::internal
-
));
}
-HarmonyArrayExtendArrayPrototype();
\ No newline at end of file
+HarmonyArrayExtendArrayPrototype();
));
}
-ExtendStringPrototype();
\ No newline at end of file
+ExtendStringPrototype();
} } // namespace v8::internal
#endif // V8_HEAP_SNAPSHOT_GENERATOR_INL_H_
-
} } // namespace v8::internal
#endif // V8_HEAP_SNAPSHOT_GENERATOR_H_
-
// Since there is no simulator for the ia32 architecture this file is empty.
-
// 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.
-
}
CHECK(cq.IsEmpty());
}
-
assertEquals('ћук', result[7]);
assertEquals('чука', result[8]);
assertEquals('џак', result[9]);
-
assertTrue(collatorTime < cachedTime);
// Non-cached time is much slower, measured to 12.5 times.
assertTrue(cachedTime < nonCachedTime);
-
// Flags: --allow-natives-syntax
var x;
%IS_VAR(x);
-%IS_VAR(x+x);
\ No newline at end of file
+%IS_VAR(x+x);
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var paren_in_arg_string_good = new Function('x', 'return;');
-var paren_in_arg_string_bad = new Function(')', 'return;');
\ No newline at end of file
+var paren_in_arg_string_bad = new Function(')', 'return;');
"use strict";
var o = { get "%3" (){} };
-o["%3"] = 10;
\ No newline at end of file
+o["%3"] = 10;
var single_function_good = "(function() { return 5; })";
%CompileString(single_function_good, true);
var single_function_bad = "(function() { return 5; })();";
-%CompileString(single_function_bad, true);
\ No newline at end of file
+%CompileString(single_function_bad, true);
}
testShadowing(1, function() { return 2; });
-
-
var args1 = weirdargs(false, null, 40);
var res = weirdargs(true, args1, 15);
assertEquals(40, res[0], "return old args element");
-assertEquals(15, res[1], "return own args element");
\ No newline at end of file
+assertEquals(15, res[1], "return own args element");
function arg_set(x) { return (arguments[x] = 117); }
assertEquals(undefined, arg_get(0xFFFFFFFF));
assertEquals(true, arg_del(0xFFFFFFFF));
-assertEquals(117, arg_set(0xFFFFFFFF));
\ No newline at end of file
+assertEquals(117, arg_set(0xFFFFFFFF));
assertEquals(2, count);
})();
-
}
TestNonSmiArrayLength();
-
}});
}
Number.prototype.arrayToLocaleString = Array.prototype.toLocaleString;
-assertEquals("42,42,42", (42).arrayToLocaleString());
\ No newline at end of file
+assertEquals("42,42,42", (42).arrayToLocaleString());
o2.z = 27;
assertEquals(27, result_z);
assertTrue(typeof o2.z == 'undefined');
-
Realm.eval(realmB, "Realm.shared.__proto__ = {c: 3}");
assertSame(1, o.a);
assertSame(undefined, o.c);
-
test(1);
test(42);
test(239);
-
assertEquals(f < x, 'f' < x, ">r" + x);
assertEquals(f <= x, 'f' <= x, ">=r" + x);
}
-
"assertFalse(" + x + " >= NaN, '' + " + x + " + ' >= NaN');\n";
eval(program);
}
-
}
assertTrue(g1(0, 0));
-assertFalse(g1(0, 1));
\ No newline at end of file
+assertFalse(g1(0, 1));
} catch(e) {
assertEquals("wow", e);
}
-
assertEquals(42, a[0]);
assertEquals(49, a[7]);
assertEquals(-19, a[23]);
-
-
-
-
assertEquals(0, f(0));
assertEquals(1, f(1));
-
function test() { return always_false() ? 0 : 1; }
assertEquals(1, test());
-
withEval(expr, function(a) { return a; });
}
%OptimizeFunctionOnNextCall(withEval);
-withEval(expr, function(a) { return a; });
\ No newline at end of file
+withEval(expr, function(a) { return a; });
main(o.g);
%OptimizeFunctionOnNextCall(main);
main(o.g);
-
assertEquals(G, f(G));
%OptimizeFunctionOnNextCall(f);
assertEquals(G, f(G));
-
assertEquals(ROR4(0xFFFFFFFF, 40), ROR4_sa40(0xFFFFFFFF));
%OptimizeFunctionOnNextCall(ROR4_sa40);
assertEquals(ROR4(0xFFFFFFFF, 40), ROR4_sa40(0xFFFFFFFF));
-
-
}
f("const x = 0;");
})();
-
assertEquals("", a1.toString());
assertEquals("", a1.toLocaleString());
assertEquals("", a1.join());
-
Debug.BreakPositionAlignment.BreakPosition).indexOf(scenario[i][1]) > 0);
Debug.clearBreakPoint(bp1);
}
-
assertEquals("bbccdcb", call_graph);
// Get rid of the debug event listener.
-Debug.setListener(null);
\ No newline at end of file
+Debug.setListener(null);
assertFalse(exception, "exception in listener")
assertTrue(listenerComplete);
-
// This getter is known to be implemented as closure.
CheckNoScopeVisible(new Error().__lookupGetter__("stack"));
-
assertEquals(5, break_point_hit_count);
f();
assertEquals(6, break_point_hit_count);
-
var z100 = Factory(100)();
assertEquals(102, z100());
-
-
exception_holder = {};
assertEquals("Cat", test.ChooseAnimal(WrapInNativeCall(WrapInDebuggerCall(WrapInCatcher(test.ScriptChanger, exception_holder)))));
assertTrue(!!exception_holder[0]);
-
caught_exception.details.syntaxErrorMessage);
assertEquals(2, caught_exception.details.position.start.line);
-
-
"yesterday\nall\nmy\ntroubles\nseemed\nso\nfar\naway",
"yesterday\nall\nmy\ntroubles\nseemed\nso\n"
);
-
assertEquals(2010, MultiChunkTranslator.Translate(60, Return2010));
assertEquals(70, MultiChunkTranslator.Translate(70));
assertEquals(75, MultiChunkTranslator.Translate(75));
-
-
assertEquals([], listenerExceptions, "Exception in listener");
// Make sure that the debug event listener vas invoked.
assertEquals(2, listenerCallCount, "Listener not called");
-
// moment. Since there's no way of simply getting the pointer to the function,
// we run this code while the script function is being activated on stack.
eval('SetBreakpointInI1Script()\nfunction i1(){}\n\n\n\nfunction i2(){}\n');
-
};
})(Object);
TestCaseWithDebugger(fun);
-
-
// With block as the last(!) statement in global code.
-with ({}) { debugger; }
\ No newline at end of file
+with ({}) { debugger; }
assertEquals(0.5, f(arr, 0));
do_set = true;
assertEquals(2, f(arr, 1));
-
var actual = [];
for (var p in o) actual.push(p);
assertArrayEquals(expected, actual);
-
-
-
-
o.message = "another message";
assertEquals("another message", o.message);
assertEquals("x is not defined", error2.message);
-
[true, false].verifyUndefined(frames, "getFileName");
["eval at <anonymous> ("].verifyContains(frames, "getEvalOrigin");
}
-
}
assertEquals(expected, f.apply(null, array), String(i));
}
-
-
assertTrue(%HasFastSmiElements(a));
a.length = (1 << 30);
assertFalse(%HasFastSmiElements(a));
-
for (var i=0; i<50; i++) {
f();
}
-
-
-
assertEquals('function(){}', strip((function () { }).toString()));
assertEquals('functionanonymous(){}', strip(new Function().toString()));
-
f = new Function(x, y, z);
assertEquals(25, f(5, 5));
assertEquals(42, f(2, 21));
-
GetPrototypeOfObject({x:5});
GetPrototypeOfObject(F);
GetPrototypeOfObject(RegExp);
-
String.prototype.__defineGetter__('x', function() { return this; });
assertEquals(Object('asdf'), 'asdf'.x);
-
// in the eval scopes. Deeper nesting this time.
test({ x: 42 }, "function f() { function g() { eval('1'); assertEquals(42, x) }; g() }; f();");
test({ y: 42 }, "function f() { function g() { eval('1'); assertEquals(27, x) }; g() }; f();");
-
eval('eval(' + source +')');
}
testEvalDontShadow('assertEquals(42, x)');
-
-
-
-
-
assertThrows('Array.prototype.find.apply({}, "", [])', TypeError);
assertThrows('Array.prototype.find.apply({}, {}, [])', TypeError);
assertThrows('Array.prototype.find.apply({}, [], [])', TypeError);
-assertThrows('Array.prototype.find.apply({}, /\d+/, [])', TypeError);
\ No newline at end of file
+assertThrows('Array.prototype.find.apply({}, /\d+/, [])', TypeError);
assertThrows('Array.prototype.findIndex.apply({}, "", [])', TypeError);
assertThrows('Array.prototype.findIndex.apply({}, {}, [])', TypeError);
assertThrows('Array.prototype.findIndex.apply({}, [], [])', TypeError);
-assertThrows('Array.prototype.findIndex.apply({}, /\d+/, [])', TypeError);
\ No newline at end of file
+assertThrows('Array.prototype.findIndex.apply({}, /\d+/, [])', TypeError);
assertTrue(w.has(k));
w.clear();
assertFalse(w.has(k));
-})();
\ No newline at end of file
+})();
repeat : String.prototype.repeat
};
assertEquals("abc", myobj.repeat(1));
-assertEquals("abcabc", myobj.repeat(2));
\ No newline at end of file
+assertEquals("abcabc", myobj.repeat(2));
for (var i = 0; i < sizes.length; i++) {
testLiteral(sizes[i]);
}
-
test("(function() { assertEquals(27, x) })();");
test("(function() { var y = 42; eval('1'); assertEquals(42, y); })();");
test("(function() { var y = 42; eval('var y = 2; var z = 2;'); assertEquals(2, y); })();");
-
test();
test();
%OptimizeFunctionOnNextCall(test);
-test();
\ No newline at end of file
+test();
testRound(min_smi31 + 1, min_smi31 + 0.5);
testRound(min_smi32, min_smi32 - 0.5);
testRound(min_smi32 + 1, min_smi32 + 0.5);
-
-
test(Infinity, Infinity);
// -Infinity is smaller than 0 so it should return NaN
test(NaN, -Infinity);
-
// Test all boolean values.
testBooleanMirror(true);
-testBooleanMirror(false);
\ No newline at end of file
+testBooleanMirror(false);
// Parse JSON representation and check.
var fromJSON = eval('(' + json + ')');
-assertEquals('undefined', fromJSON.type);
\ No newline at end of file
+assertEquals('undefined', fromJSON.type);
f(562949903089665, 16777215);
f(562949936644096, 16777216);
f(562949970198527, 16777217);
-f(1125899839733761, 33554431);
\ No newline at end of file
+f(1125899839733761, 33554431);
}
TestFloatQuietNan();
-
-
-
-
// 2 => not optimized.
assertUnoptimized(u1);
assertOptimized(u2);
-}
\ No newline at end of file
+}
assertTrue(x === new Construct(x));
x = function() { };
assertTrue(x === new Construct(x));
-
// Allow LF+CR in multiline string literals.
code = "'asdf\\" + String.fromCharCode(0xA) + String.fromCharCode(0xD) + "asdf'";
assertEquals('asdfasdf', eval(code));
-
-
// dtoa does not do this in its original form.
assertEquals("1.3", 1.25.toPrecision(2), "1.25.toPrecision(2)");
assertEquals("1.4", 1.35.toPrecision(2), "1.35.toPrecision(2)");
-
-
-
(-91.1234).toPrecision(6);
(-91.1234).toPrecision(7);
(-91.1234).toPrecision(8);
-
// dtoa does not do this in its original form.
assertEquals("1.3", 1.25.toPrecision(2), "1.25.toPrecision(2)");
assertEquals("1.4", 1.35.toPrecision(2), "1.35.toPrecision(2)");
-
-
-
assertEquals(7, test5[13]);
assertEquals(7, test6[17.31]);
-
for (var i = 0; i < sizes.length; i++) {
testLiteral(sizes[i]);
}
-
test_with_optimization(test5);
test_with_optimization(test6);
}
-
assertEquals(87, object[key]);
object[key]++;
assertEquals(88, object[key]);
-
test.__proto__ = (new Array()).__proto__;
test.length = 14;
assertEquals(14, test.length);
-
-
CheckMatch(/a|(?:)/g, "aba", [[0, 1], [1, 0], [2, 1], [3, 0]]);
CheckMatch(/a|(?:)/g, "baba", [[0, 0], [1, 1], [2, 0], [3, 1], [4, 0]]);
-CheckMatch(/a|(?:)/g, "bab", [[0, 0], [1, 1], [2, 0], [3, 0]]);
\ No newline at end of file
+CheckMatch(/a|(?:)/g, "bab", [[0, 0], [1, 1], [2, 0], [3, 0]]);
words[0] = "Enemies,";
words = string.split(" ");
assertEquals("Friends,", words[0]);
-
// to store the 33rd character. This fails an ASSERT in debug mode.
assertEquals(33, "12345678901234567890123456789012\u2028".length);
-
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Make sure that the Debug object does not return to the global object
-assertTrue(typeof(Debug) === 'undefined');
\ No newline at end of file
+assertTrue(typeof(Debug) === 'undefined');
assertEquals(2, Number(object));
assertEquals('I', String(object)[0]);
-
this.x = 1;
this.y = 2;
this.z = 3;
-
}
%OptimizeFunctionOnNextCall(y);
-assertTrue(y("foo"));
\ No newline at end of file
+assertTrue(y("foo"));
{ configurable: true, enumerable: true, value: 3 });
assertEquals(3, this[1]);
assertTrue(this.hasOwnProperty("1"));
-
assertEquals("01", TestBreak());
assertEquals("01", TestContinue());
-
assertEquals(Infinity, 1/bar(5));
%OptimizeFunctionOnNextCall(bar);
assertEquals(-Infinity, 1/bar(-5));
-
})();
assertEquals(87, value);
-
-
check(150);
check(200);
-check(350);
\ No newline at end of file
+check(350);
assertEquals(0xaf, parseInt("0xaf", radix));
assertEquals(0xaf, parseInt("af", radix));
}
-
var a = new Object();
assertEquals(gee, a.findOrStore());
assertEquals(gee, a.findOrStore());
-
h();
assertFalse(exception);
-
};
fail("case 10", "Default case", "Heap number not recognized as Smi value");
})();
-
// Should't throw. Scanner incorrectly truncated to char before comparing
// with "*", so it ended the comment early.
-eval("/*\u822a/ */");
\ No newline at end of file
+eval("/*\u822a/ */");
var expected_message = "ReferenceError: f is not defined";
assertTrue(stack.indexOf(expected_message) >= 0);
assertFalse(used_custom_lookup);
-
%OptimizeFunctionOnNextCall(f);
t.number = 2;
f();
-
// Surprise mod with overflow.
assertEquals(-Infinity, 1/mod(-2147483648, -1));
-
var str = Array(10000).join("X");
str.replace(/^|X/g, function(m, i, s) {
if (i > 0) assertEquals("X", m, "at position 0x" + i.toString(16));
-});
\ No newline at end of file
+});
var a = "abcdefghijklmnopqrstuvqxy"+"z";
externalizeString(a, true);
-assertEquals('b', a.substring(1).charAt(0));
\ No newline at end of file
+assertEquals('b', a.substring(1).charAt(0));
test1();
test2();
assertEquals(3, break_count);
-
runTest(testLocal);
runTest(testConstLocal);
runTest(testGlobal);
-
// Crash does not occur when code is run at the top level.
test();
-
// The call to f should get the constructor of the receiver which is
// the constructor of the global object.
assertEquals(constructor, f());
-
-
assertFalse(f(-5));
assertFalse(f(0));
assertFalse(f(10));
-
Check(d.setUTCDate(10));
Check(d.setUTCMonth(10));
Check(d.setUTCFullYear(2010));
-
}
assertThrows(strict_function);
-
} catch (e) {
assertUnreachable();
}
-
for (var i = 0; i < 10000; i++){
(i + "\u1234\0").split(/(.)\1/i);
}
-
// function should no longer deopt when called.
test();
assertOptimized(test);
-
assertThrows(function() { %_CallFunction(null, 0, ""); });
assertThrows(function() { %_CallFunction(null, 0, 1); });
-
foo = foo + 'b' + foo;
foo.replace(/b/, "a");
-
-
//Shouldn't crash.
var res = re.test(str);
-assertTrue(res);
\ No newline at end of file
+assertTrue(res);
var obj2 = JSON.parse(msg);
assertEquals(JSON.stringify(obj), JSON.stringify(obj2));
-assertEquals(JSON.stringify(obj, null, 0), JSON.stringify(obj2));
\ No newline at end of file
+assertEquals(JSON.stringify(obj, null, 0), JSON.stringify(obj2));
assertTrue(error_stack.indexOf("test stack") > 0);
assertTrue(error_stack.indexOf("illegal") < 0);
-
Object.freeze(b);
Array.prototype.sort.call(b);
assertPropertiesEqual({0: 5, 1: 4, 2: 3, 3: 2, 4: 1, 5: 0, length: 6}, b);
-
testSideEffects("zzzz", /a/g);
testSideEffects("xaxa", /a/);
testSideEffects("xaxa", /a/g);
-
object_factory(1, 0, [1, 0, 0]),
object_factory(2, 1, [1, 1, 0])));
assertFlags([1, 1, 1]);
-
-
// See: http://code.google.com/p/v8/issues/detail?id=246
assertTrue(/(?:text)/.test("text"));
-assertEquals(["text"], /(?:text)/.exec("text"));
\ No newline at end of file
+assertEquals(["text"], /(?:text)/.exec("text"));
"\u00e6"]; // Latin-1 character.
assertEquals('["\u56e7","\u00e6"]', JSON.stringify(o));
-assertEquals('["\u56e7","\u00e6"]', JSON.stringify(o, null, 0));
\ No newline at end of file
+assertEquals('["\u56e7","\u00e6"]', JSON.stringify(o, null, 0));
assertTrue(isNaN(boom(0)));
assertTrue(isNaN(boom(0)));
assertTrue(isNaN(boom(0)));
-
-
-
}
source += '"';
eval(source);
-
f();
%OptimizeFunctionOnNextCall(f);
f();
-
f();
%OptimizeFunctionOnNextCall(f);
f();
-
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
assertTrue(/\1[a]/.test("\1a"));
-
var s3 = "string for triggering osr in Cb";
for (var i = 0; i < 16; i++) s3 = s3 + s3;
Cb(s3);
-Cb(s1 + s2);
\ No newline at end of file
+Cb(s1 + s2);
assertEquals("\xff", "\u0178".toLowerCase());
assertEquals("ABCDEFGHIJKLMN\u0178OPQ",
("abcdefghijk" + "lmn\xffopq").toUpperCase());
-
// Ensure replacement with string allows $ in replacement string.
assertEquals("a$ec", "abc".replace("b", "$e"), "$e isn't meaningful");
-
TestArray(Float32Array);
TestArray(Float64Array);
TestArray(Uint8ClampedArray);
-
var res = re.test("xx");
assertEquals(i % 3 != 2, res, "testres" + i);
}
-
-
X.prototype.x = {x:1}
new X()
-
assertFalse(Infinity == -Infinity);
assertEquals(Infinity, 1 / 1e-9999);
assertEquals(-Infinity, 1 / -1e-9999);
-
for(var i = 0; i < 1024; i++) {
assertEquals(i, obj[i]);
}
-
}
assertFalse(XXX('Hello'));
-
assertFalse(typeof 'x' === 'object');
assertFalse(typeof Object == 'object');
assertFalse(typeof Object === 'object');
-
// Check that IC bails out.
assertEquals(42, g());
-
assertEquals(73, '\111'.charCodeAt(0));
assertEquals(105, '\151'.charCodeAt(0));
-
-
assertTrue(catcher(void 0, 'foo') instanceof TypeError);
assertTrue(catcher(null, 123) instanceof TypeError);
assertTrue(catcher(void 0, 123) instanceof TypeError);
-
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
assertEquals(JSON.stringify(obj, null, 5.99999), JSON.stringify(obj, null, 5));
-
assertEquals(10, i);
assertEquals(10, j);
-
-
f();
%OptimizeFunctionOnNextCall(f);
f();
-
assertEquals(1, f());
assertEquals(undefined, g());
assertEquals(undefined, h());
-
assertClose(-Math.PI / 4, Math.atan2(ninf, pinf));
assertClose( 3 * Math.PI / 4, Math.atan2(pinf, ninf));
assertClose(-3 * Math.PI / 4, Math.atan2(ninf, ninf));
-
}
Debug.setBreakPoint(a, 0, 0);
-new a(1, 2);
\ No newline at end of file
+new a(1, 2);
};
assertThrows("f()");
-
f();
// Make sure that the debug event listener vas invoked.
-assertTrue(listenerCalled);
\ No newline at end of file
+assertTrue(listenerCalled);
assertEquals("Infinity", String(1/f()));
%OptimizeFunctionOnNextCall(f);
assertEquals("Infinity", String(1/f()));
-
var a = [];
Object.defineProperty(a, 0, {});
assertThrows(function() { a.pop(); });
-
assertEquals(t2(undefined,2), NaN/2);
assertEquals(t2(1,1<<30), 1/(1<<30));
assertEquals(t2(1,2), 1/2);
-
a[100000] = 0;
a.join();
assertEquals("hest", foo);
-
assertEquals(1, JSON.parse('{"0":1}')[0]);
assertEquals(undefined, JSON.parse('{"00":1}')[0]);
-
r3 = "(" + r3 + ")a";
}
"test".match(RegExp(r3));
-
((0).toLocaleString)();
} catch (e) {
assertInstanceof(e, TypeError);
-}
\ No newline at end of file
+}
g.apply(this, array);
g("a", "b", "c");
assertNull(error);
-
assertEquals(1, hole(0));
assertEquals(1, hole(0));
%OptimizeFunctionOnNextCall(hole);
-assertEquals(0, hole(1));
\ No newline at end of file
+assertEquals(0, hole(1));
var b = [0];
g(b);
g(b);
-assertEquals(undefined, g(a));
\ No newline at end of file
+assertEquals(undefined, g(a));
eval("debugger");
Debug.setListener(null);
assertTrue(listened);
-
});
assertEquals("Test1 test1", "test1 test1".cap());
assertEquals("Test2 Test2", "test2 test2".cap(true));
-
Debug.setListener(null);
assertTrue(listened);
-
%OptimizeFunctionOnNextCall(StringFromCharCode);
StringFromCharCode(0x7C, 0x7C);
StringFromCharCode(0xFFF, 0xFFF);
-
%OptimizeFunctionOnNextCall(String.fromCharCode);
String.fromCharCode(0x7C, 0x7C);
String.fromCharCode(0xFFF, 0xFFF);
-
test();
%OptimizeFunctionOnNextCall(test);
test();
-
test(Math.tan, -1.57079632679489660000, "Math.tan");
test(Math.sin, 6.283185307179586, "Math.sin");
-
o = new g();
assertEquals(1, o.x);
assertEquals(2, o.y);
-
array[i * stride] = i;
}
}
-
-
}, "QuickSort");
// Not omitted even though ADD from runtime.js is a non-native builtin.
-testNotOmittedBuiltin(function(){ thrower + 2; }, "ADD");
\ No newline at end of file
+testNotOmittedBuiltin(function(){ thrower + 2; }, "ADD");
testPrepareStackTrace(function() { throw new Error("foo"); });
testPrepareStackTrace(function f() { f(); });
-
delete o.x;
store(o);
assertEquals(42, o.x);
-
assertTrue(isNaN(toNumber("+0x012")));
assertTrue(isNaN(toNumber("-0x0")));
assertTrue(isNaN(toNumber("-0xFF")));
-assertTrue(isNaN(toNumber("-0x012")));
\ No newline at end of file
+assertTrue(isNaN(toNumber("-0x012")));
assertFalse(1 === new Number(1));
assertTrue(4.2 === 4.2);
assertTrue(4.2 === Number(4.2));
-
-
-
-
test();
%OptimizeFunctionOnNextCall(test);
test();
-
var bar = foo.replace(/[a]/g, moving_string);
print(bar.length);
-
var r = s.search(s);
assertEquals(0, r);
}
-
test_crankshaft();
%OptimizeFunctionOnNextCall(test_crankshaft);
-test_crankshaft();
\ No newline at end of file
+test_crankshaft();
assertEquals("-91.1234", (-91.1234).toPrecision(6));
assertEquals("-91.12340", (-91.1234).toPrecision(7));
assertEquals("-91.123400", (-91.1234).toPrecision(8));
-
assertTrue(!!new Number(-1), "new Number(-1)");
assertTrue(!!new Number(0), "new Number(0)");
assertTrue(!!new Number(1), "new Number(1)");
-
-
assertEquals(4294967295, ToUInt32('4294967295'), "'4294967295'");
assertEquals(0, ToUInt32('4294967296'), "'4294967296'");
assertEquals(1, ToUInt32('4294967297'), "'4294967297'");
-
-
assertTrue(Math.atan(x) != Math.atan(y));
assertTrue(Math.exp(x) != Math.exp(y));
-
}
}
}
-assertEquals(9, f);
\ No newline at end of file
+assertEquals(9, f);
s += s;
}
assertTrue(isNaN(Number(s)), "long-string");
-
var thai_l_regexp2 = new RegExp("[" + thai_l_thingy + "]");
assertTrue(thai_l_regexp.test(thai_l_thingy));
assertTrue(thai_l_regexp2.test(thai_l_thingy));
-
-
/* This should be fairly easy again. May need some work in the
compiler's VisitWith() function, or perhaps the runtime routine's
PushContextForWith().
-*/
\ No newline at end of file
+*/
"use\x20strict";
var x = "hello\040world";
return x;
-}
\ No newline at end of file
+}
"use\040strict";
var x = "hello\040world";
return x;
-}
\ No newline at end of file
+}
"use\u0020strict";
var x = "hello\040world";
return x;
-}
\ No newline at end of file
+}
arguments *= arguments--;
function arguments(arguments) {};
try {} catch (arguments) {}
-
eval *= eval--;
function eval(eval) {};
try {} catch (eval) {}
-
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"use strict";
-const x = 42;
\ No newline at end of file
+const x = 42;
"use strict";
var re = RegExp("Hello\\040World");
return re;
-}
\ No newline at end of file
+}
"use strict";
var x = 012;
return x;
-}
\ No newline at end of file
+}
"use strict";
var re = /hello\040world/;
return re;
-}
\ No newline at end of file
+}
"use strict";
var x = "hello\040world";
return x;
-}
\ No newline at end of file
+}
"use strict";
"use\040strict";
return true;
-}
\ No newline at end of file
+}
"use\040strict";
"use strict";
return true;
-}
\ No newline at end of file
+}
function foo() {
"use strict";
with ({}) {}
-}
\ No newline at end of file
+}
shouldBe('indexArguments("1 ", "a")', 'undefined');
shouldBe('indexArguments(0xDEADBEEF)', 'undefined');
shouldBe('indexArguments(0xFFFFFFFF)', 'undefined');
-
Object.defineProperty(Array.prototype, 0, { writable: false });
shouldBe("[42].concat()", "[42]");
-
-
}
shouldBe("foo(" + f + ", " + array + ", 0)", expected);
}
-
for (var i = 0; i < 100; ++i)
shouldBe("foo(\"foo\" + i)", "NaN");
-
for (var i = 0; i < 200; ++i)
shouldBe("bar(42)", "1764");
-
var c = i + 3;
shouldBe("foo(a, b, c)", "6");
}
-
for (var i = 0; i < 200; ++i)
shouldBe("bar(42)", "42");
-
for (var i = 0; i < 200; ++i)
shouldBe("bar(42)", "42");
-
result = "" +foo.apply(void 0, args);
shouldBe("result", expected);
}
-
}
shouldBe("bar(" + a + ", " + b + ", {f:" + c + "})", "" + expected);
}
-
}
shouldBe("bar(" + a + ", " + b + ")", "" + expected);
}
-
for (var i = 0; i < 1000; ++i) {
shouldBe("foo()", "2");
}
-
for (var i = 0; i < 1000; ++i) {
shouldBe("foo({f:[]})", "42");
}
-
var expected = i + (i == 199 ? 2147483647 : 5) + (i !== 5 ? 1 : -1)
shouldBe("foo(i, 5, i == 199 ? 2147483647 : 5)", "" + expected);
}
-
shouldBe("bar({f:True})", "0");
shouldBe("bar({f:False})", "1");
}
-
expected = -1;
shouldBe("bar(i, i + 1)", "" + expected);
}
-
expected = 56;
shouldBe("callFoo(o)", "" + expected);
}
-
}
shouldBe("bar.call({f:baz}, fuzz)", "\"fuzz\"");
-
}
shouldBe("foo(o)", expected);
}
-
-
}
shouldBe("foo(o)", expected);
}
-
shouldBe("result[0]", expectedFirst);
shouldBe("result[1]", expectedSecond);
}
-
for (var i = 0; i < 200; ++i)
shouldBe("thingy(o)", "42");
-
} else
shouldThrow("foo({f:42}, null)");
}
-
} else
shouldThrow("foo({f:42}, null)");
}
-
for (var i = 0; i < 200; ++i)
shouldBe("bar(5)", "42");
-
shouldBe("foo1(new Stuff())", "43");
shouldBe("foo2(new Stuff())", "58");
}
-
-
// Call foo() enough times to make totally sure that we optimize.
for (var i = 0; i < 5; ++i)
shouldBe("foo(0.5)", "1000.50025");
-
-
for (var i = 0; i < 200; ++i)
shouldBe("foo(i, i + 1)", "162");
-
for (var i = 0; i < 1000; ++i)
shouldBe("foo(i)(false)", "42");
-
shouldBe("ok", "" + i);
shouldBe("result", "" + expected);
}
-
shouldBe("ok", "" + i);
shouldBe("result", "100");
}
-
shouldBe("foo(thingy, i)", "10");
shouldBe("variable", "" + expected);
}
-
code += "); foo(firstArg, secondArg)";
shouldBe(code, "1");
}
-
for (var i = 0; i < 200; ++i)
shouldBe("foo(0.5)", "42.5");
-
}
shouldBe("grandResult", "14578304");
-
-
shouldBe("foo(w)", "1");
w.length = 2;
shouldBe("foo(w)", "0/0");
-
// Undo.
array1[0] = 1;
}
-
});
shouldBe("bar(o)", i < 100 ? "\"Returned result: " + i + "\"" : "\"Threw exception: Oh hi, I'm an exception!\"");
}
-
-
o.__defineGetter__("f", function(){ return i; });
shouldBe("foo(o)", "" + i);
}
-
-
for (var i = 0; i < 100; ++i)
shouldBe("foo([75])", "[1,2]");
-
-
}
shouldBe("baz(arg1, arg2)", "" + expected);
}
-
result = "" + bar();
shouldBe("result", expected);
}
-
for (var __i = 0; __i < 200; ++__i)
shouldBe("argsToStr(bar(\"a\" + __i, \"b\" + __i, \"c\" + __i))", "\"[object Arguments]: a" + __i + ", b" + __i + ", c" + __i + "\"");
-
for (var __i = 0; __i < 200; ++__i)
shouldThrow("argsToStr(bar(\"a\" + __i, \"b\" + __i, \"c\" + __i))");
-
var text3 = "[[object Arguments]: 42, 56]";
shouldBe("argsToStr(bar(o, \"b\" + __i, \"c\" + __i))", "\"[[object Arguments],[object Arguments],[object Arguments],[object Arguments],[object Arguments],[object Arguments],[object Arguments],[object Arguments],[object Arguments],[object Arguments]: " + text1 + ", " + text1 + ", " + text1 + ", " + text1 + ", " + text1 + ", " + text2 + ", " + text1 + ", " + text1 + ", " + text2 + ", " + text3 + "]\"");
}
-
for (var __i = 0; __i < 200; ++__i)
shouldBe("argsToStr(bar(o, \"b\" + __i, \"c\" + __i))", "\"[object Arguments]: [object Object], b" + __i + ", c" + __i + "\"");
-
shouldBe("resultArray[2]", "\"makeInlinableCall\"");
shouldBe("resultArray[1]", "\"inlineable\"");
shouldBe("resultArray[0]", "\"nonInlineable\"");
-
shouldBe("baz(object, " + i + ", " + (i * 2) + ")", "" + (offset + i + i * 2));
}
-
shouldBe("baz(object, " + i + ", " + (i * 2) + ")", "" + (offset + i + i * 2));
}
-
}
shouldBe("foo(0)", "-4094336");
-
for (var i = 0; i < 200; ++i)
shouldBe("foo(2147483647)", "2147483552");
-
-
shouldBe("result.a", "" + eval("((" + a + " + " + b + ") | 0)"))
shouldBe("result.b", "" + eval(a + " + " + b))
}
-
}
shouldBe("foo(array)", expected);
}
-
shouldBe("baz(object, " + i + ", " + (i * 2) + ")", "" + (offset + Math.max(i, i * 2)));
}
-
shouldBe("baz(object, " + i + ", " + (i * 2) + ")", "" + (offset + Math.max(i, i * 2)));
}
-
}
shouldBe("foo(" + f + ", " + array + ", 0)", expected);
}
-
}
shouldBe("foo(" + f + ", " + array + ", 0)", expected);
}
-
for (var i = 0; i < 200; ++i)
shouldBe("foo(i, i + 1, i + 2)", "1");
-
for (var i = 0; i < 100; ++i)
shouldBe("foo(2147483647)", "-65536");
-
-
-
for (var i = 0; i < 1000; ++i)
shouldBe("foo(2147483647)", "140737488289792");
-
-
for (var i = 0; i < 100; ++i)
shouldBe("foo(2147483647, 2147483646)", "-2147483648");
-
-
}
shouldBe("foo(predicate, {f:object})", "" + expected);
}
-
shouldBe("doMultiplyConstant4(-1073741824)", "-4294967296");
shouldBe("doMultiplyConstant4(-2147483648)", "-8589934592");
}
-
foo(array, -1);
shouldBe("array[-1]", "42");
}
-
}
shouldBe("foo(o, p)", "" + expected);
}
-
} else
shouldThrow("foo({f:42}, null)");
}
-
} else
shouldThrow("foo({f:42}, null)");
}
-
for (var i = 0; i < 200; ++i)
shouldBe("foo(i < 190 ? {f:42, g:{h:3}} : {f:42, g:{}})", "false");
-
for (var i = 0; i < 200; ++i)
shouldBe("foo(i < 190 ? {f:42, g:{h:3}} : {f:42, g:{}})", "false");
-
myProto.g = 67;
shouldBe("foo({g:new Thingy()})", "42");
}
-
}
shouldBe("foo(array, 0)", expected);
}
-
else
shouldBe("o.foo", "void 0");
}
-
-
shouldBe("o.f", "6");
shouldBe("o.g", "7");
}
-
-
} else
shouldBe("o.f", "" + i);
}
-
else
shouldBe("o.foo", "void 0");
}
-
-
shouldBe("o.m", "13");
shouldBe("o.n", "14");
}
-
-
shouldBe("foo(array, -1, i)", "42");
shouldBe("thingy", "" + i);
}
-
for (var i = 0; i < 200; ++i)
shouldBe("sum([2147483646, 2147483644])", "4294967290");
-
}
shouldBe("foo(" + f + ", " + array + ", 0)", expected);
}
-
}
shouldBe("foo(3, {f:f, g:g}, p)", "" + expected);
}
-
shouldBe("foo({f:\"" + a + "\"}, {f:\"" + b + "\"})", "[" + (a.length + b.length) + ", " + areEqual + "]");
shouldBe("bar({f:\"" + a + "\"}, {f:\"" + b + "\"})", "" + (areEqual ? a.length + b.length + 1 : a.length + b.length - 1));
}
-
shouldBe("thingy.length", "1");
shouldBe("thingy[0]", "false");
}
-
shouldBe("thingy.length", "1");
shouldBe("thingy[0]", "false");
}
-
for (var i = 0; i < 100; ++i)
shouldBe("\"\" + foo(\"foo\", i % 2 ? \"hello\" : [1, 2, 3])", i % 2 ? "\"foo,hello\"" : "\"foo,1,2,3\"");
-
for (var i = 0; i < 100; ++i)
shouldBe("\"\" + foo(\"foo\", i % 2 ? \"hello\" : 42)", i % 2 ? "\"foo,hello\"" : "\"foo,42\"");
-
String.prototype.toString = function() { return 42; }
shouldBe("foo.call(new String(\"foo\"))", i >= 99 ? "\"42\"" : "\"foo\"");
}
-
}
shouldBe("\"\" + foo(\"hello\")", expected);
}
-
}
shouldBe("\"\" + foo(\"hello\")", expected);
}
-
}
shouldBe("\"\" + foo(argument)", expected);
}
-
}
shouldBe("\"\" + foo(argument)", "\"hello\"");
}
-
for (var i = 0; i < 100; ++i)
shouldBe("foo(-1)", "[-1, 4294967295]");
-
for (var i = 0; i < 100; ++i)
shouldBe("foo(" + i + ")()", "" + i);
-
}
shouldBe("foo(i, 1, o)", "" + expected);
}
-
shouldBe("foo({f:2147483648}, {f:32})", "2147483648");
shouldBe("foo({f:2147483648}, {f:31})", "1");
shouldBe("foo({f:2147483648}, {f:30})", "2");
-
foo(array);
shouldBe("array[0]", "0x8005465c");
}
-
shouldBe("o2.f", "false");
shouldBe("o3.f", "false");
}
-
}
shouldBe('JSON.stringify(JSON.parse("[0,1]", reviveIntroducesNewArrayLikeObject))', '\'[0,["a","a"]]\'');
-
-
} catch (ex) {
var msg = String(eval(ex));
shouldBe("msg", "'RangeError: Maximum call stack size exceeded.'");
- }
\ No newline at end of file
+ }
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
+ }
Number.prototype.toLocaleString = backupNumberToLocaleString;
RegExp.prototype.toString = backupRegExpToString;
RegExp.prototype.toLocaleString = backupRegExpToLocaleString;
-}
\ No newline at end of file
+}
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
+shouldBeTrue("false.toString() === 'false'");
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
+shouldBe("d.setYear(2100), d.getFullYear()", "2100");
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
+shouldBe("Object.prototype.toString.apply(EvalError)", "'[object Function]'");
shouldBeFalse("isFinite(parseFloat('Infinity'))");
shouldBeFalse("delete NaN");
shouldBeFalse("delete Infinity");
-shouldBeFalse("delete undefined");
\ No newline at end of file
+shouldBeFalse("delete undefined");
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
+shouldBe("Number(0).toPrecision(21)","\"0.00000000000000000000\"");
shouldBe("String(Object())", "'[object Object]'");
shouldBe("Object().toString()", "'[object Object]'");
-shouldBe("String(Object().valueOf())", "'[object Object]'");
\ No newline at end of file
+shouldBe("String(Object().valueOf())", "'[object Object]'");
///////////////////////////////////////////////////////
-shouldBe("delete Boolean.prototype", "false");
\ No newline at end of file
+shouldBe("delete Boolean.prototype", "false");
shouldBe("/(?:)/.toString()", "'/(?:)/'");
shouldBe("/(?:)/.source", "'(?:)'");
-debug("Done.");
\ No newline at end of file
+debug("Done.");
test1();
test2(42);
test3();
-test4();
\ No newline at end of file
+test4();
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
+shouldBe("var i = -8; i >>>= 24", "255");
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
+shouldBe("String(Array('a', 'b' ))", "'a,b'");
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
-// comment with linebreak
\ No newline at end of file
+// comment with linebreak
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
-// comment with linebreak
\ No newline at end of file
+// comment with linebreak
val = eval("14; function f() {}");
shouldBe("val", "14");
val = eval("15; var v = 0");
-shouldBe("val", "15");
\ No newline at end of file
+shouldBe("val", "15");
var a = 1;
if ( undefined )
a = 2;
-shouldBe("/*var a=1;if (undefined) a = 2;*/ a", "1");
\ No newline at end of file
+shouldBe("/*var a=1;if (undefined) a = 2;*/ a", "1");
shouldBe("ReferenceError.length","1");
shouldBe("SyntaxError.length","1");
shouldBe("TypeError.length","1");
-shouldBe("URIError.length","1");
\ No newline at end of file
+shouldBe("URIError.length","1");
v.toString();
} catch (e) {
debug("OK. Caught an exception.");
-}
\ No newline at end of file
+}
foo();
} catch (e) {
debug("OK. Caught an exception");
-}
\ No newline at end of file
+}
description("KDE JS Test");
shouldBe("a = 1; delete a;", "true");
shouldBe("delete nonexistant;", "true");
-shouldBe("delete NaN", "false");
\ No newline at end of file
+shouldBe("delete NaN", "false");
// (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
+description("KDE JS Test");
}
checkWithFunctions("encodeURI", "decodeURI");
-checkWithFunctions("encodeURIComponent", "decodeURIComponent");
\ No newline at end of file
+checkWithFunctions("encodeURIComponent", "decodeURIComponent");
for (var j = 0; j < 1; j++)
return eval('j');
}
-shouldBe("lotto()", "0");
\ No newline at end of file
+shouldBe("lotto()", "0");
shouldBe("(new Error()).message", "''");
// the empty match isn't taken in account
-shouldBe("''.split(/.*/).length", "0");
\ No newline at end of file
+shouldBe("''.split(/.*/).length", "0");
catch (e) {
}
shouldBe("set_inside_with_cantconverttoobject","4");
-// ### test case, sw
\ No newline at end of file
+// ### test case, sw
testReferenceError();
testFunctionError();
testMathFunctionError();
-testWhileAbortion();
\ No newline at end of file
+testWhileAbortion();
}
}
-test();
\ No newline at end of file
+test();
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
+shouldBe("Error.prototype.toString.__proto__","Function.prototype");
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
+shouldBe("list", "'123'");
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
-<!-- HTML comment (not ECMA)
\ No newline at end of file
+<!-- HTML comment (not ECMA)
// 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
+--> end of HTML comment (not ECMA)
shouldBe("01", "1");
shouldBe("010", "8");
shouldBe("09", "9");
-shouldBe("019", "19");
\ No newline at end of file
+shouldBe("019", "19");
} catch (e) {
testFailed(f + " threw an exception " + e + " when no exception expected");
}
-}
\ No newline at end of file
+}
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
+shouldBe("list","'myprop,'");
return s;
}
-shouldBe("MD5('kde')", "'186cf28b76f2264e9fea8fcf91cb4f5d'");
\ No newline at end of file
+shouldBe("MD5('kde')", "'186cf28b76f2264e9fea8fcf91cb4f5d'");
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
+function calcMD5(str) { return binl2hex(coreMD5( str2binl(str))) }
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
+shouldBe("checkEnumerable(myfunc,'someproperty')","true");
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
+shouldBe("_function.toString()","\"[object Function]\"");
// 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
+shouldBe("(new Boolean()) instanceof Number", "false");
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
+shouldBe("var test = { }; test.i= 0; test.i\u002b= 1; test.i;", "1");
var foundStringPrototypeLength = false;
for (i in String.prototype) { if (i == "length") foundStringPrototypeLength = true; }
-shouldBe("foundStringPrototypeLength","false");
\ No newline at end of file
+shouldBe("foundStringPrototypeLength","false");
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
+shouldBe("Error.prototype.__proto__","Object.prototype");
}
testForIn();
-shouldBe("g", "'foo'"); //Before the eval, g was in outer scope, but not after!
\ No newline at end of file
+shouldBe("g", "'foo'"); //Before the eval, g was in outer scope, but not after!
return result;
};
-shouldBe("testSwitch4(0)", "'ab'");
\ No newline at end of file
+shouldBe("testSwitch4(0)", "'ab'");
var overrideVar2 = 1;
var overrideVar2 = 2;
-shouldBe("overrideVar2", "2");
\ No newline at end of file
+shouldBe("overrideVar2", "2");
shouldThrow("String.prototype.anchor.call(null)", '"TypeError: Type error"');
// Check anchor.length.
-shouldBe("String.prototype.anchor.length", "1");
\ No newline at end of file
+shouldBe("String.prototype.anchor.length", "1");
shouldThrow("String.prototype.fontcolor.call(null)", '"TypeError: Type error"');
// Check fontcolor.length.
-shouldBe("String.prototype.fontcolor.length", "1");
\ No newline at end of file
+shouldBe("String.prototype.fontcolor.length", "1");
shouldThrow("String.prototype.fontsize.call(null)", '"TypeError: Type error"');
// Check fontsize.length.
-shouldBe("String.prototype.fontsize.length", "1");
\ No newline at end of file
+shouldBe("String.prototype.fontsize.length", "1");
shouldThrow("String.prototype.link.call(null)", '"TypeError: Type error"');
// Check link.length.
-shouldBe("String.prototype.link.length", "1");
\ No newline at end of file
+shouldBe("String.prototype.link.length", "1");
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
+ successfullyParsed = true;
var regex24 = /(?=a|b?)c/;
shouldBe("regex24.exec('x')", "null");
-
shouldBeTrue("re !== new RegExp(re)");
shouldThrow("re === RegExp(re,'i')");
shouldThrow("re !== new RegExp(re,'i')");
-
var regexp13 = /.*\n\d+.*/;
shouldBe("regexp13.exec('abc\\n123')", "['abc\\n123']");
-
shouldBe("regexp58.exec('badbc')", "['a']");
var regexp59 = /(X(?:.(?!X))*?Y)|(Y(?:.(?!Y))*?Z)/g;
shouldBe("'Y aaa X Match1 Y aaa Y Match2 Z'.match(regexp59)", "['X Match1 Y','Y Match2 Z']");
-
}
shouldBe("bar()", "3");
-
-
-
shouldBe("foo(r)", "113");
shouldBe("foo(s)", "182");
}
-
}
shouldBe("foo()", "300");
-
-
shouldBe("foo(r)", "113");
shouldBe("foo(s)", "182");
}
-
this[42] = "foo";
shouldBe("thingy", "\"foo\"");
-
for (var i = 0; i < 100; ++i)
shouldBe("foo([, 1.5], 0)", "void 0");
-
shouldBe('testInOperator(' + i + ')', tests[i][2]);
shouldBe('testForEachFunction(' + i + ')', tests[i][2]);
}
-
shouldBe('s1.match(re34)', '[""]');
shouldBe('s2.match(re34)', '[""]');
shouldBe('s3.match(re34)', '[""]');
-
shouldBe("foo(42).length", "1");
shouldBe("foo(42, 23)[1]", "23");
}
-
});
testPassed("It worked.");
-
-
} catch (e) {
testPassed("Exception thrown and caught");
}
-
shouldBe("trimLeft.call("+testValues[i]+")", "'"+eval(testValues[i])+"'");
shouldBe("trimRight.call("+testValues[i]+")", "'"+eval(testValues[i])+"'");
}
-
}
shouldBe("\"\" + events", "\"1:try,1:finally,2:finally,2:thingy,3:thingy,3:finally,4:thingy,4:finally,4:another thingy,5:hi,5:wat\"");
-
} catch (e) {
testPassed("It worked.");
}
-
} catch (e) {
testPassed("It worked.");
}
-
shouldBe("var x\u200c = 42; x\u200c", "42");
shouldBe("var x\u200d = 43; x\u200d", "43");
-shouldBe("var x\u200c\u200d = 44; x\u200c\u200d", "44");
\ No newline at end of file
+shouldBe("var x\u200c\u200d = 44; x\u200c\u200d", "44");
this.data = data;
this.next = next;
};
-
if __name__ == "__main__":
main()
-
else:
print "%s has trailing whitespaces in line %s." % (name, linenumbers)
result = False
+ if not contents.endswith('\n') or contents.endswith('\n\n'):
+ print "%s does not end with a single new line." % name
+ result = False
# Check two empty lines between declarations.
if name.endswith(".cc"):
line = 0
def FinishAndWrite(self, file):
xml.ElementTree(self.root).write(file, "UTF-8")
-