fix: improve test regex to validate disallowed methods that can be bypassed by prototype reassignments and/or otherwise (#38214)

* fix: improve test regex to validate disallowed methods that can be bypassed by prototype reassignments and/or otherwise

* fix: fixing regex pattern
This commit is contained in:
Hassaan Pasha
2020-03-26 20:13:34 +05:00
committed by GitHub
parent bb7a50e341
commit 4fbce07792
13 changed files with 18 additions and 16 deletions

View File

@ -31,7 +31,7 @@ tests:
- text: <code>bubbleSort</code> should return an array that is unchanged except for order.
testString: assert.sameMembers(bubbleSort([1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]), [1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]);
- text: <code>bubbleSort</code> should not use the built-in <code>.sort()</code> method.
testString: assert.strictEqual(code.search(/\.sort\(/), -1);
testString: assert(!code.match(/\.?[\s\S]*?sort/));
```

View File

@ -29,7 +29,7 @@ tests:
- text: <code>insertionSort</code> should return an array that is unchanged except for order.
testString: assert.sameMembers(insertionSort([1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]), [1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]);
- text: <code>insertionSort</code> should not use the built-in <code>.sort()</code> method.
testString: assert.strictEqual(code.search(/\.sort\(/), -1);
testString: assert(!code.match(/\.?[\s\S]*?sort/));
```

View File

@ -33,7 +33,7 @@ tests:
- text: <code>mergeSort</code> should return an array that is unchanged except for order.
testString: assert.sameMembers(mergeSort([1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]), [1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]);
- text: <code>mergeSort</code> should not use the built-in <code>.sort()</code> method.
testString: assert.strictEqual(code.search(/\.sort\(/), -1);
testString: assert(!code.match(/\.?[\s\S]*?sort/));
```

View File

@ -30,7 +30,7 @@ tests:
- text: <code>quickSort</code> should return an array that is unchanged except for order.
testString: assert.sameMembers(quickSort([1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]), [1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]);
- text: <code>quickSort</code> should not use the built-in <code>.sort()</code> method.
testString: assert.strictEqual(code.search(/\.sort\(/), -1);
testString: assert(!code.match(/\.?[\s\S]*?sort/));
```

View File

@ -29,7 +29,7 @@ tests:
- text: <code>selectionSort</code> should return an array that is unchanged except for order.
testString: assert.sameMembers(selectionSort([1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]), [1,4,2,8,345,123,43,32,5643,63,123,43,2,55,1,234,92]);
- text: <code>selectionSort</code> should not use the built-in <code>.sort()</code> method.
testString: assert.strictEqual(code.search(/\.sort\(/), -1);
testString: assert(!code.match(/\.?[\s\S]*?sort/));
```