Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various bugs in test cases #1988

Merged
merged 1 commit into from
Dec 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/class-elements/prod-private-async-method.case
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async #m() { return 42; }
//- constructor
assert.sameValue(this.#m.name, '#m', 'function name inside constructor');
ctorPromise = this.#m().then(value => {
assert.sameValue(this.#m(), 42, 'already defined in the ctor');
assert.sameValue(value, 42, 'already defined in the ctor');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops! Thanks again for catching this!

}, $DONE);

//- assertions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: >
features: [Array.prototype.flatMap]
---*/

assert(Array.prototype.flatMap);
assert.sameValue(typeof Array.prototype.flatMap, "function");

assert.throws(TypeError, function() {
[].flatMap({});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ info: |
9.1.12 [[OwnPropertyKeys]] ( )

1. Let keys be a new empty List.
2. For each own property key P of O that is an integer index, in ascending
2. For each own property key P of O that is an array index, in ascending
numeric index order
a. Add P as the last element of keys.
3. For each own property key P of O that is a String but is not an integer
3. For each own property key P of O that is a String but is not an array
index, in property creation order
a. Add P as the last element of keys.
4. For each own property key P of O that is a Symbol, in property creation
Expand All @@ -36,18 +36,22 @@ var o1 = {
[Number.MAX_SAFE_INTEGER]: true,
[Symbol.for('z')]: true,
12345678901: true,
4294967294: true,
4294967295: true,
};

var result = Reflect.ownKeys(o1);

assert.sameValue(result.length, 7);
assert.sameValue(result.length, 9);
assert.sameValue(result[0], '1');
assert.sameValue(result[1], '12345678900');
assert.sameValue(result[2], '12345678901');
assert.sameValue(result[3], String(Number.MAX_SAFE_INTEGER));
assert.sameValue(result[4], 'b');
assert.sameValue(result[5], 'a');
assert.sameValue(result[6], Symbol.for('z'));
assert.sameValue(result[1], '4294967294');
assert.sameValue(result[2], '12345678900');
assert.sameValue(result[3], 'b');
assert.sameValue(result[4], 'a');
assert.sameValue(result[5], String(Number.MAX_SAFE_INTEGER));
assert.sameValue(result[6], '12345678901');
assert.sameValue(result[7], '4294967295');
assert.sameValue(result[8], Symbol.for('z'));

var o2 = {};

Expand All @@ -58,15 +62,19 @@ o2.a = true;
o2[Number.MAX_SAFE_INTEGER] = true;
o2[Symbol.for('z')] = true;
o2[12345678901] = true;
o2[4294967294] = true;
o2[4294967295] = true;


result = Reflect.ownKeys(o2);

assert.sameValue(result.length, 7);
assert.sameValue(result.length, 9);
assert.sameValue(result[0], '1');
assert.sameValue(result[1], '12345678900');
assert.sameValue(result[2], '12345678901');
assert.sameValue(result[3], String(Number.MAX_SAFE_INTEGER));
assert.sameValue(result[4], 'b');
assert.sameValue(result[5], 'a');
assert.sameValue(result[6], Symbol.for('z'));
assert.sameValue(result[1], '4294967294');
assert.sameValue(result[2], '12345678900');
assert.sameValue(result[3], 'b');
assert.sameValue(result[4], 'a');
assert.sameValue(result[5], String(Number.MAX_SAFE_INTEGER));
assert.sameValue(result[6], '12345678901');
assert.sameValue(result[7], '4294967295');
assert.sameValue(result[8], Symbol.for('z'));
6 changes: 3 additions & 3 deletions test/intl402/NumberFormat/currencyDisplay-unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: Checks handling of valid values for the numeric option to the Relat
info: |
SetNumberFormatUnitOptions ( intlObj, options )

6. Let currencyDisplay be ? GetOption(options, "currencyDisplay", "string", « "code", "symbol", "narrowSymbol", "name" », "symbol").
6. Let currencyDisplay be ? GetOption(options, "currencyDisplay", "string", « "code", "symbol", "narrow-symbol", "name" », "symbol").
11. If style is "currency", then
f. Set intlObj.[[CurrencyDisplay]] to currencyDisplay.

Expand All @@ -16,8 +16,8 @@ features: [Intl.NumberFormat-unified]

const validOptions = [
[undefined, "symbol"],
["narrowSymbol", "narrowSymbol"],
[{ toString() { return "narrowSymbol"; } }, "narrowSymbol"],
["narrow-symbol", "narrow-symbol"],
[{ toString() { return "narrow-symbol"; } }, "narrow-symbol"],
];

for (const [validOption, expected] of validOptions) {
Expand Down
2 changes: 1 addition & 1 deletion test/intl402/NumberFormat/style-unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const validOptions = [
];

for (const [validOption, expected] of validOptions) {
const nf = new Intl.NumberFormat([], {"style": validOption});
const nf = new Intl.NumberFormat([], {"style": validOption, "unit": "generic"});
const resolvedOptions = nf.resolvedOptions();
assert.sameValue(resolvedOptions.style, expected);
}
2 changes: 1 addition & 1 deletion test/intl402/Segmenter/iterator/following.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const tests = [
];

for (const [input, position] of tests) {
assert.sameValue(iter.following(0 | input), false);
assert.sameValue(iter.following(input), false);
assert.sameValue(iter.position, position, String(input));
}

Expand Down
6 changes: 1 addition & 5 deletions test/intl402/Segmenter/iterator/granularity.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,5 @@ for (const granularity of ["grapheme", "word", "sentence", "line"]) {

assert.sameValue(typeof iter.position, "number");
assert.sameValue(iter.position, 0);
if (granularity === "grapheme") {
assert.sameValue(iter.breakType, undefined);
} else {
assert.sameValue(typeof iter.breakType, "string");
}
assert.sameValue(iter.breakType, undefined);
}
3 changes: 1 addition & 2 deletions test/intl402/Segmenter/iterator/preceding.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ const tests = [
];

for (const [input, position] of tests) {
assert.sameValue(iter.preceding(0 | input), false);
assert.sameValue(iter.preceding(input), false);
assert.sameValue(iter.position, position, String(input));
}

assert.throws(RangeError, () => iter.preceding("ABC"));
assert.throws(RangeError, () => iter.preceding(null));
assert.throws(RangeError, () => iter.preceding(1.4));
assert.throws(RangeError, () => iter.preceding(-3));

// 1.5.3.3 %SegmentIteratorPrototype%.preceding( [ from ] )
Expand Down
2 changes: 1 addition & 1 deletion test/intl402/Segmenter/prototype/segment/segment-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ for (const text of [
"법원 “다스 지분 처분권·수익권 모두 MB가 보유”", // Korean
]) {
const iter = seg.segment(text);
assert(["soft", "hard"].includes(iter.breakType), iter.breakType);
assert.sameValue(undefined, iter.breakType);
assert.sameValue(0, iter.position);
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ for (const text of [
"법원 “다스 지분 처분권·수익권 모두 MB가 보유”", // Korean
]) {
const iter = seg.segment(text);
assert(["sep", "term"].includes(iter.breakType), iter.breakType);
assert.sameValue(undefined, iter.breakType);
assert.sameValue(0, iter.position);
}
2 changes: 1 addition & 1 deletion test/intl402/Segmenter/prototype/segment/segment-word.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ for (const text of [
"법원 “다스 지분 처분권·수익권 모두 MB가 보유”", // Korean
]) {
const iter = seg.segment(text);
assert(["word", "none"].includes(iter.breakType), iter.breakType);
assert.sameValue(undefined, iter.breakType);
assert.sameValue(0, iter.position);
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ var C = class {

assert.sameValue(this.#m.name, '#m', 'function name inside constructor');
ctorPromise = this.#m().then(value => {
assert.sameValue(this.#m(), 42, 'already defined in the ctor');
assert.sameValue(value, 42, 'already defined in the ctor');
}, $DONE);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class C {

assert.sameValue(this.#m.name, '#m', 'function name inside constructor');
ctorPromise = this.#m().then(value => {
assert.sameValue(this.#m(), 42, 'already defined in the ctor');
assert.sameValue(value, 42, 'already defined in the ctor');
}, $DONE);

}
Expand Down