-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: A way to exclude by features. Closes gh-146
- Loading branch information
Showing
12 changed files
with
280 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
// Copyright (C) 2017 Ecma International. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
description: | | ||
Collection of assertion functions used throughout test262 | ||
---*/ | ||
|
||
function assert(mustBeTrue, message) { | ||
if (mustBeTrue === true) { | ||
return; | ||
} | ||
|
||
if (message === undefined) { | ||
message = 'Expected true but got ' + String(mustBeTrue); | ||
} | ||
$ERROR(message); | ||
} | ||
|
||
assert._isSameValue = function (a, b) { | ||
if (a === b) { | ||
// Handle +/-0 vs. -/+0 | ||
return a !== 0 || 1 / a === 1 / b; | ||
} | ||
|
||
// Handle NaN vs. NaN | ||
return a !== a && b !== b; | ||
}; | ||
|
||
assert.sameValue = function (actual, expected, message) { | ||
if (assert._isSameValue(actual, expected)) { | ||
return; | ||
} | ||
|
||
if (message === undefined) { | ||
message = ''; | ||
} else { | ||
message += ' '; | ||
} | ||
|
||
message += 'Expected SameValue(«' + String(actual) + '», «' + String(expected) + '») to be true'; | ||
|
||
$ERROR(message); | ||
}; | ||
|
||
assert.notSameValue = function (actual, unexpected, message) { | ||
if (!assert._isSameValue(actual, unexpected)) { | ||
return; | ||
} | ||
|
||
if (message === undefined) { | ||
message = ''; | ||
} else { | ||
message += ' '; | ||
} | ||
|
||
message += 'Expected SameValue(«' + String(actual) + '», «' + String(unexpected) + '») to be false'; | ||
|
||
$ERROR(message); | ||
}; | ||
|
||
assert.throws = function (expectedErrorConstructor, func, message) { | ||
if (typeof func !== "function") { | ||
$ERROR('assert.throws requires two arguments: the error constructor ' + | ||
'and a function to run'); | ||
return; | ||
} | ||
if (message === undefined) { | ||
message = ''; | ||
} else { | ||
message += ' '; | ||
} | ||
|
||
try { | ||
func(); | ||
} catch (thrown) { | ||
if (typeof thrown !== 'object' || thrown === null) { | ||
message += 'Thrown value was not an object!'; | ||
$ERROR(message); | ||
} else if (thrown.constructor !== expectedErrorConstructor) { | ||
message += 'Expected a ' + expectedErrorConstructor.name + ' but got a ' + thrown.constructor.name; | ||
$ERROR(message); | ||
} | ||
return; | ||
} | ||
|
||
message += 'Expected a ' + expectedErrorConstructor.name + ' to be thrown but no exception was thrown at all'; | ||
$ERROR(message); | ||
}; | ||
|
||
assert.throws.early = function(err, code) { | ||
var wrappedCode = 'function wrapperFn() { ' + code + ' }'; | ||
var ieval = eval; | ||
|
||
assert.throws(err, function() { Function(wrappedCode); }, 'Function: ' + code); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (C) 2017 Ecma International. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
description: | | ||
---*/ | ||
|
||
function __consolePrintHandle__(msg) { | ||
print(msg); | ||
} | ||
|
||
function $DONE(error) { | ||
if (error) { | ||
if(typeof error === 'object' && error !== null && 'name' in error) { | ||
__consolePrintHandle__('Test262:AsyncTestFailure:' + error.name + ': ' + error.message); | ||
} else { | ||
__consolePrintHandle__('Test262:AsyncTestFailure:Test262Error: ' + error); | ||
} | ||
} else { | ||
__consolePrintHandle__('Test262:AsyncTestComplete'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) 2012 Ecma International. All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
/*--- | ||
description: | | ||
Provides both: | ||
- An error class to avoid false positives when testing for thrown exceptions | ||
- A function to explicitly throw an exception using the Test262Error class | ||
---*/ | ||
|
||
|
||
function Test262Error(message) { | ||
this.message = message || ""; | ||
} | ||
|
||
Test262Error.prototype.toString = function () { | ||
return "Test262Error: " + this.message; | ||
}; | ||
|
||
var $ERROR; | ||
$ERROR = function $ERROR(message) { | ||
throw new Test262Error(message); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
description: Async test | ||
expected: | ||
pass: true | ||
features: [A] | ||
flags: [async] | ||
---*/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ negative: | |
type: RangeError | ||
expected: | ||
pass: true | ||
features: [A,B] | ||
flags: [async] | ||
---*/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.