diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /js/src/jit-test/tests/fields/field_types.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/fields/field_types.js')
-rw-r--r-- | js/src/jit-test/tests/fields/field_types.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/fields/field_types.js b/js/src/jit-test/tests/fields/field_types.js new file mode 100644 index 0000000000..f93991c321 --- /dev/null +++ b/js/src/jit-test/tests/fields/field_types.js @@ -0,0 +1,43 @@ +class C { + [Math.sqrt(16)]; + [Math.sqrt(8)] = 5 + 2; + "hi"; + "bye" = {}; + 2 = 2; + 0x101 = 2; + 0o101 = 2; + 0b101 = 2; + NaN = 0; // actually the field called "NaN", not the number + Infinity = 50; // actually the field called "Infinity", not the number + // all the keywords below are proper fields (?!?) + with = 0; + //static = 0; // doesn't work yet + async = 0; + get = 0; + set = 0; + export = 0; + function = 0; +} + +let obj = new C(); +assertEq(Math.sqrt(16) in obj, true); +assertEq(obj[Math.sqrt(16)], undefined); +assertEq(obj[Math.sqrt(8)], 7); +assertEq("hi" in obj, true); +assertEq(obj["hi"], undefined); +assertEq(typeof obj["bye"], "object"); +assertEq(obj[2], 2); +assertEq(obj[0x101], 2); +assertEq(obj[0o101], 2); +assertEq(obj[0b101], 2); +assertEq(obj.NaN, 0); +assertEq(obj.Infinity, 50); +assertEq(obj.with, 0); +assertEq(obj.async, 0); +assertEq(obj.get, 0); +assertEq(obj.set, 0); +assertEq(obj.export, 0); +assertEq(obj.function, 0); + +if (typeof reportCompare === "function") + reportCompare(true, true); |