Skip to content

Commit fff41f0

Browse files
trflynn89Ms2ger
authored andcommitted
Fix running Temporal tests in strict mode
Previously, a ReferenceError would be thrown for the options object in these loops.
1 parent 47de75b commit fff41f0

File tree

8 files changed

+14
-14
lines changed

8 files changed

+14
-14
lines changed

test/built-ins/Temporal/Duration/from/argument-non-string.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ for (const [arg, description] of primitiveTests) {
2929
`${description} does not convert to a valid ISO string`
3030
);
3131

32-
for (options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
32+
for (const options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
3333
assert.throws(
3434
TypeError,
3535
() => Temporal.Duration.from(arg, options),

test/built-ins/Temporal/Instant/from/argument-wrong-type.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ for (const [arg, description] of primitiveTests) {
2929
`${description} does not convert to a valid ISO string`
3030
);
3131

32-
for (options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
32+
for (const options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
3333
assert.throws(
3434
TypeError,
3535
() => Temporal.Instant.from(arg, options),

test/built-ins/Temporal/PlainDate/from/argument-wrong-type.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ for (const [arg, description] of primitiveTests) {
2727
`${description} does not convert to a valid ISO string`
2828
);
2929

30-
for (options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
30+
for (const options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
3131
assert.throws(
3232
typeof arg === 'string' ? RangeError : TypeError,
3333
() => Temporal.PlainDate.from(arg, options),
@@ -46,7 +46,7 @@ const typeErrorTests = [
4646
for (const [arg, description] of typeErrorTests) {
4747
assert.throws(TypeError, () => Temporal.PlainDate.from(arg), `${description} is not a valid property bag and does not convert to a string`);
4848

49-
for (options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
49+
for (const options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
5050
assert.throws(TypeError, () => Temporal.PlainDate.from(arg, options), `${description} is not a valid property bag and does not convert to a string with options ${options}`);
5151
}
5252
}

test/built-ins/Temporal/PlainDateTime/from/argument-wrong-type.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ for (const [arg, description] of primitiveTests) {
2727
`${description} does not convert to a valid ISO string`
2828
);
2929

30-
for (options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
30+
for (const options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
3131
assert.throws(
3232
typeof arg === 'string' ? RangeError : TypeError,
3333
() => Temporal.PlainDateTime.from(arg, options),
@@ -46,7 +46,7 @@ const typeErrorTests = [
4646
for (const [arg, description] of typeErrorTests) {
4747
assert.throws(TypeError, () => Temporal.PlainDateTime.from(arg), `${description} is not a valid property bag and does not convert to a string`);
4848

49-
for (options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
49+
for (const options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
5050
assert.throws(TypeError, () => Temporal.PlainDateTime.from(arg, options), `${description} is not a valid property bag and does not convert to a string with options ${options}`);
5151
}
5252
}

test/built-ins/Temporal/PlainMonthDay/from/argument-wrong-type.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ for (const [arg, description] of primitiveTests) {
2727
`${description} does not convert to a valid ISO string`
2828
);
2929

30-
for (options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
30+
for (const options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
3131
assert.throws(
3232
typeof arg === 'string' ? RangeError : TypeError,
3333
() => Temporal.PlainMonthDay.from(arg, options),
@@ -46,7 +46,7 @@ const typeErrorTests = [
4646
for (const [arg, description] of typeErrorTests) {
4747
assert.throws(TypeError, () => Temporal.PlainMonthDay.from(arg), `${description} is not a valid property bag and does not convert to a string`);
4848

49-
for (options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
49+
for (const options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
5050
assert.throws(TypeError, () => Temporal.PlainMonthDay.from(arg, options), `${description} is not a valid property bag and does not convert to a string with options ${options}`);
5151
}
5252
}

test/built-ins/Temporal/PlainTime/from/argument-wrong-type.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ for (const [arg, description] of primitiveTests) {
2727
`${description} does not convert to a valid ISO string`
2828
);
2929

30-
for (options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
30+
for (const options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
3131
assert.throws(
3232
typeof arg === 'string' ? RangeError : TypeError,
3333
() => Temporal.PlainTime.from(arg, options),
@@ -46,7 +46,7 @@ const typeErrorTests = [
4646
for (const [arg, description] of typeErrorTests) {
4747
assert.throws(TypeError, () => Temporal.PlainTime.from(arg), `${description} is not a valid property bag and does not convert to a string`);
4848

49-
for (options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
49+
for (const options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
5050
assert.throws(TypeError, () => Temporal.PlainTime.from(arg, options), `${description} is not a valid property bag and does not convert to a string with options ${options}`);
5151
}
5252
}

test/built-ins/Temporal/PlainYearMonth/from/argument-wrong-type.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ for (const [arg, description] of primitiveTests) {
2727
`${description} does not convert to a valid ISO string`
2828
);
2929

30-
for (options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
30+
for (const options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
3131
assert.throws(
3232
typeof arg === 'string' ? RangeError : TypeError,
3333
() => Temporal.PlainYearMonth.from(arg, options),
@@ -46,7 +46,7 @@ const typeErrorTests = [
4646
for (const [arg, description] of typeErrorTests) {
4747
assert.throws(TypeError, () => Temporal.PlainYearMonth.from(arg), `${description} is not a valid property bag and does not convert to a string`);
4848

49-
for (options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
49+
for (const options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
5050
assert.throws(TypeError, () => Temporal.PlainYearMonth.from(arg, options), `${description} is not a valid property bag and does not convert to a string with options ${options}`);
5151
}
5252
}

test/built-ins/Temporal/ZonedDateTime/from/argument-wrong-type.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ for (const [arg, description] of primitiveTests) {
2828
`${description} does not convert to a valid ISO string`
2929
);
3030

31-
for (options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
31+
for (const options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
3232
assert.throws(
3333
typeof arg === 'string' ? RangeError : TypeError,
3434
() => Temporal.ZonedDateTime.from(arg, options),
@@ -47,7 +47,7 @@ const typeErrorTests = [
4747
for (const [arg, description] of typeErrorTests) {
4848
assert.throws(TypeError, () => Temporal.ZonedDateTime.from(arg), `${description} is not a valid property bag and does not convert to a string`);
4949

50-
for (options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
50+
for (const options of [undefined, { overflow: 'constrain' }, { overflow: 'reject' }]) {
5151
assert.throws(TypeError, () => Temporal.ZonedDateTime.from(arg, options), `${description} is not a valid property bag and does not convert to a string with options ${options}`);
5252
}
5353
}

0 commit comments

Comments
 (0)