Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ShortDevelopment authored and rhuanjl committed Apr 23, 2024
1 parent 1a03ab0 commit 1f6e17c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 44 deletions.
68 changes: 30 additions & 38 deletions test/Array/array_splice_double.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ WScript.Echo(a);
WScript.Echo(x);

//Test array
var b = [8.32,9.232];
var c = [11.232,12.234];
var b = [8.32, 9.232];
var c = [11.232, 12.234];

x = a.splice(5,1);
x = a.splice(5, 1);
WScript.Echo(x);
WScript.Echo(a);

Expand All @@ -73,7 +73,7 @@ f.x = 0;
f.y = 1;
f.z = 2;

x = a.splice(1,2, f, "hello");
x = a.splice(1, 2, f, "hello");
WScript.Echo(x);
WScript.Echo(a);

Expand Down Expand Up @@ -116,37 +116,31 @@ WScript.Echo(x.length);
x = new String("hello world");
x.foo = Array.prototype.splice;
y = undefined;
try
{
y = x.foo(0, 5);
try {
y = x.foo(0, 5);
}
catch(e)
{
if (!(e instanceof TypeError)) throw(e);
WScript.Echo(y);
WScript.Echo(x);
catch (e) {
if (!(e instanceof TypeError)) throw (e);
WScript.Echo(y);
WScript.Echo(x);
}

try
{
y = x.foo(0, 5);
try {
y = x.foo(0, 5);
}
catch(e)
{
if (!(e instanceof TypeError)) throw(e);
WScript.Echo(y);
WScript.Echo(x);
catch (e) {
if (!(e instanceof TypeError)) throw (e);
WScript.Echo(y);
WScript.Echo(x);
}

try
{
y = x.foo(0, 13);
try {
y = x.foo(0, 13);
}
catch(e)
{
if (!(e instanceof TypeError)) throw(e);
WScript.Echo(y);
WScript.Echo(x);
catch (e) {
if (!(e instanceof TypeError)) throw (e);
WScript.Echo(y);
WScript.Echo(x);
}

WScript.Echo("Test: splice when the item to replace is not writable."); // WOOB: 1139812
Expand All @@ -155,23 +149,21 @@ Object.defineProperty(a, "0", { value: 0 });
Object.defineProperty(a, "1", { value: 1 });
a.length = 2;
try {
Array.prototype.splice.apply(a, [0, 1, 'z']);
Array.prototype.splice.apply(a, [0, 1, 'z']);
} catch (ex) {
WScript.Echo("e instanceOf TypeError = " + (ex instanceof TypeError));
WScript.Echo("e instanceOf TypeError = " + (ex instanceof TypeError));
}
WScript.Echo("a.length = " + a.length);

a = new Array(1000);
x = a.splice(1, 17, "a");

function test0()
{
var arr = [0,1.12,2.23,3,4.32,5,6.23,7,8,9];
for(var __loopvar4 = 0; __loopvar4 < 2; __loopvar4++)
{
arr.length --;
arr.splice(3,1,31.23,32.32,33.23);
function test0() {
var arr = [0, 1.12, 2.23, 3, 4.32, 5, 6.23, 7, 8, 9];
for (var __loopvar4 = 0; __loopvar4 < 2; __loopvar4++) {
arr.length--;
arr.splice(3, 1, 31.23, 32.32, 33.23);
}
return arr.length;
}
WScript.Echo("arr.length = " + test0());
WScript.Echo("arr.length = " + test0());
9 changes: 3 additions & 6 deletions test/es5/RegExpStrictDelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,17 @@
var props = Object.getOwnPropertyNames(RegExp);
props.sort();

for (var i = 0, len = props.length; i < len; i++)
{
for (var i = 0, len = props.length; i < len; i++) {
var prop = props[i];
if (prop === 'prototype')
continue;
try
{
try {
WScript.Echo("Testing: delete RegExp[" + prop + "]");
var result = delete RegExp[prop];
if (result === false)
WScript.Echo("Error: strict delete returned false");
}
catch (err)
{
catch (err) {
if (!(err instanceof TypeError))
WScript.Echo("Error: strict delete threw a non-TypeError: " + err);
}
Expand Down

0 comments on commit 1f6e17c

Please sign in to comment.