ladybird/Libraries/LibJS/Tests/for-basic.js
Brian Gianforcaro bc40908d32 LibJS: Use the native assert() implementation now avaiable in 'js -t'
Switch the LibJS test suite to use the native assert implementation
surfaced inside the js repl when it's launched in test mode.
2020-04-05 15:28:45 +02:00

22 lines
416 B
JavaScript

try {
var a = [];
for (var i = 0; i < 3; ++i) {
a.push(i);
}
assert(a.length === 3);
assert(a[0] === 0);
assert(a[1] === 1);
assert(a[2] === 2);
for (; a.length < 6;) {
a.push('x');
}
assert(a.length === 6);
assert(a[3] === 'x');
assert(a[4] === 'x');
assert(a[5] === 'x');
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}