summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Object/getOwnPropertyDescriptors/primitive-strings.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/built-ins/Object/getOwnPropertyDescriptors/primitive-strings.js
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--js/src/tests/test262/built-ins/Object/getOwnPropertyDescriptors/primitive-strings.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/getOwnPropertyDescriptors/primitive-strings.js b/js/src/tests/test262/built-ins/Object/getOwnPropertyDescriptors/primitive-strings.js
new file mode 100644
index 0000000000..a17d1d9102
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Object/getOwnPropertyDescriptors/primitive-strings.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 Jordan Harband. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Object.getOwnPropertyDescriptors accepts string primitives.
+esid: sec-object.getownpropertydescriptors
+author: Jordan Harband
+---*/
+
+var result = Object.getOwnPropertyDescriptors('abc');
+
+assert.sameValue(Object.keys(result).length, 4, 'string has 4 descriptors');
+
+assert.sameValue(result.length.configurable, false, 'length is not configurable');
+assert.sameValue(result.length.enumerable, false, 'length is not enumerable');
+assert.sameValue(result.length.writable, false, 'length is not writable');
+assert.sameValue(result.length.value, 3, 'length is 3');
+
+assert.sameValue(result[0].configurable, false, 'index 0 is not configurable');
+assert.sameValue(result[0].enumerable, true, 'index 0 is enumerable');
+assert.sameValue(result[0].writable, false, 'index 0 is not writable');
+assert.sameValue(result[0].value, 'a', 'index 0 is "a"');
+
+assert.sameValue(result[1].configurable, false, 'index 1 is not configurable');
+assert.sameValue(result[1].enumerable, true, 'index 1 is enumerable');
+assert.sameValue(result[1].writable, false, 'index 1 is not writable');
+assert.sameValue(result[1].value, 'b', 'index 1 is "b"');
+
+assert.sameValue(result[2].configurable, false, 'index 2 is not configurable');
+assert.sameValue(result[2].enumerable, true, 'index 2 is enumerable');
+assert.sameValue(result[2].writable, false, 'index 2 is not writable');
+assert.sameValue(result[2].value, 'c', 'index 2 is "c"');
+
+reportCompare(0, 0);