mirror of https://github.com/tc39/test262.git
Use assert api instead of $ERROR
This commit is contained in:
parent
6ab3b0901b
commit
fa9aae7750
|
@ -9,29 +9,15 @@ description: "ControlLetter :: RUSSIAN ALPHABET is incorrect"
|
|||
---*/
|
||||
|
||||
//CHECK#0410-042F
|
||||
var result = true;
|
||||
for (var alpha = 0x0410; alpha <= 0x042F; alpha++) {
|
||||
var str = String.fromCharCode(alpha % 32);
|
||||
var arr = (new RegExp("\\c" + String.fromCharCode(alpha))).exec(str);
|
||||
if (arr !== null) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (result !== true) {
|
||||
$ERROR('#1: RUSSIAN CAPITAL ALPHABET is incorrect');
|
||||
assert.sameValue(arr, null, 'RUSSIAN CAPITAL ALPHABET: ' + alpha);
|
||||
}
|
||||
|
||||
//CHECK#0430-044F
|
||||
var result = true;
|
||||
for (alpha = 0x0430; alpha <= 0x044F; alpha++) {
|
||||
str = String.fromCharCode(alpha % 32);
|
||||
arr = (new RegExp("\\c" + String.fromCharCode(alpha))).exec(str);
|
||||
if (arr !== null) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (result !== true) {
|
||||
$ERROR('#2: russian small alphabet is incorrect');
|
||||
assert.sameValue(arr, null, 'russian small alphabet: ' + alpha);
|
||||
}
|
||||
|
|
|
@ -19,24 +19,11 @@ var __expected = ["1\n\n\n\n\nl"];
|
|||
__expected.index = 4;
|
||||
__expected.input = "line1\n\n\n\n\nline2";
|
||||
|
||||
//CHECK#1
|
||||
if (__executed.length !== __expected.length) {
|
||||
$ERROR('#1: __executed = /[\\d][\\12-\\14]{1,}[^\\d]/.exec("line1\\n\\n\\n\\n\\nline2"); __executed.length === ' + __expected.length + '. Actual: ' + __executed.length);
|
||||
}
|
||||
|
||||
//CHECK#2
|
||||
if (__executed.index !== __expected.index) {
|
||||
$ERROR('#2: __executed = /[\\d][\\12-\\14]{1,}[^\\d]/.exec("line1\\n\\n\\n\\n\\nline2"); __executed.index === ' + __expected.index + '. Actual: ' + __executed.index);
|
||||
}
|
||||
|
||||
//CHECK#3
|
||||
if (__executed.input !== __expected.input) {
|
||||
$ERROR('#3: __executed = /[\\d][\\12-\\14]{1,}[^\\d]/.exec("line1\\n\\n\\n\\n\\nline2"); __executed.input === ' + __expected.input + '. Actual: ' + __executed.input);
|
||||
}
|
||||
assert.sameValue(__executed.length, __expected.length, '.length');
|
||||
assert.sameValue(__executed.index, __expected.index, '.index');
|
||||
assert.sameValue(__executed.input, __expected.input, '.input');
|
||||
|
||||
//CHECK#4
|
||||
for(var index=0; index<__expected.length; index++) {
|
||||
if (__executed[index] !== __expected[index]) {
|
||||
$ERROR('#4: __executed = /[\\d][\\12-\\14]{1,}[^\\d]/.exec("line1\\n\\n\\n\\n\\nline2"); __executed[' + index + '] === ' + __expected[index] + '. Actual: ' + __executed[index]);
|
||||
}
|
||||
for(var index=0; index < __expected.length; index++) {
|
||||
assert.sameValue(__executed[index], __expected[index], 'index: ' + index);
|
||||
}
|
||||
|
|
|
@ -13,9 +13,6 @@ description: >
|
|||
check results
|
||||
---*/
|
||||
|
||||
var __executed = /\b(\w+) \2\b/.test("do you listen the the band");
|
||||
var executed = /\b(\w+) \2\b/.test("do you listen the the band");
|
||||
|
||||
//CHECK#1
|
||||
if (__executed) {
|
||||
$ERROR('#1: /\\b(\\w+) \\2\\b/.test("do you listen the the band") === false');
|
||||
}
|
||||
assert.sameValue(executed, false);
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Check type of various properties
|
||||
es5id: B.2.1
|
||||
description: Checking properties of this object (escape)
|
||||
---*/
|
||||
|
||||
if (typeof this.escape === "undefined") $ERROR('#1: typeof this.escape !== "undefined"');
|
||||
if (typeof this['escape'] === "undefined") $ERROR('#2: typeof this["escape"] !== "undefined"');
|
|
@ -9,8 +9,11 @@ description: >
|
|||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var global = this;
|
||||
assert.sameValue(typeof this.escape, "function");
|
||||
assert.sameValue(typeof this["escape"], "function");
|
||||
|
||||
verifyWritable(global, "escape");
|
||||
verifyNotEnumerable(global, "escape");
|
||||
verifyConfigurable(global, "escape");
|
||||
verifyProperty(this, "escape", {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
info: Check type of various properties
|
||||
es5id: B.2.2
|
||||
description: Checking properties of this object (unescape)
|
||||
---*/
|
||||
|
||||
if (typeof this.unescape === "undefined") $ERROR('#1: typeof this.unescape !== "undefined"');
|
||||
if (typeof this['unescape'] === "undefined") $ERROR('#2: typeof this["unescape"] !== "undefined"');
|
|
@ -9,6 +9,11 @@ description: >
|
|||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
verifyWritable(this, "unescape");
|
||||
verifyNotEnumerable(this, "unescape");
|
||||
verifyConfigurable(this, "unescape");
|
||||
assert.sameValue(typeof this.unescape, "function");
|
||||
assert.sameValue(typeof this["unescape"], "function");
|
||||
|
||||
verifyProperty(this, "unescape", {
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
Loading…
Reference in New Issue