mirror of
https://github.com/tc39/test262.git
synced 2025-09-25 11:08:49 +02:00
Remove test which checks if unsupported class fields don't crash
This commit is contained in:
parent
0b5357f7d8
commit
a08fdc081c
@ -1,65 +0,0 @@
|
||||
// Copyright (C) 2024 Mozilla Corporation. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
flags:
|
||||
- noStrict
|
||||
description: |
|
||||
pending
|
||||
esid: pending
|
||||
---*/
|
||||
// Field syntax doesn't crash the engine when fields are disabled.
|
||||
|
||||
// Are fields enabled?
|
||||
let fieldsEnabled = false;
|
||||
try {
|
||||
Function("class C { x; }");
|
||||
fieldsEnabled = true;
|
||||
} catch (exc) {
|
||||
assert.sameValue(exc instanceof SyntaxError, true);
|
||||
}
|
||||
|
||||
// If not, run these tests. (Many other tests cover actual behavior of the
|
||||
// feature when enabled.)
|
||||
if (!fieldsEnabled) {
|
||||
let source = `class C {
|
||||
x
|
||||
}`;
|
||||
assert.throws(SyntaxError, () => Function(source));
|
||||
|
||||
source = `class C {
|
||||
x = 0;
|
||||
}`;
|
||||
assert.throws(SyntaxError, () => Function(source));
|
||||
|
||||
source = `class C {
|
||||
0 = 0;
|
||||
}`;
|
||||
assert.throws(SyntaxError, () => Function(source));
|
||||
|
||||
source = `class C {
|
||||
[0] = 0;
|
||||
}`;
|
||||
assert.throws(SyntaxError, () => Function(source));
|
||||
|
||||
source = `class C {
|
||||
"hi" = 0;
|
||||
}`;
|
||||
assert.throws(SyntaxError, () => Function(source));
|
||||
|
||||
source = `class C {
|
||||
"hi" = 0;
|
||||
}`;
|
||||
assert.throws(SyntaxError, () => Function(source));
|
||||
|
||||
source = `class C {
|
||||
d = function(){};
|
||||
}`;
|
||||
assert.throws(SyntaxError, () => Function(source));
|
||||
|
||||
source = `class C {
|
||||
d = class D { x = 0; };
|
||||
}`;
|
||||
assert.throws(SyntaxError, () => Function(source));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user