Test that string comparison is per-code-unit (#4457)

This commit is contained in:
Andreu Botella 2025-04-18 11:57:19 +02:00 committed by GitHub
parent 5b7101ae71
commit c5257e6119
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 96 additions and 8 deletions

View File

@ -5,7 +5,7 @@
info: |
If neither x, nor y is a prefix of each other, returned result of strings
comparison applies a simple lexicographic ordering to the sequences of
code point value values
code unit value values
es5id: 11.8.4_A4.12_T1
description: x and y are string primitives
---*/
@ -44,3 +44,25 @@ if (("a\u0000b" >= "a\u0000a") !== true) {
if (("aa" >= "aB") !== true) {
throw new Test262Error('#7: ("aa" >= aB") === true');
}
//CHECK#8
if (("\u{10000}" >= "\uD7FF") !== true) {
throw new Test262Error('#8: ("\\u{10000}" >= "\\uD7FF") === true');
}
//CHECK#9
if (("\uDC00" >= "\uD800") !== true) {
throw new Test262Error('#9: ("\\uDC00" >= "\\uD800") === true');
}
//CHECK#10
// String comparison is done by code units, rather than by code points.
// "\u{10000}" is equivalent to "\uD800\uDC00"
if (("\u{10000}" >= "\uFFFF") !== false) {
throw new Test262Error('#10: ("\\u{10000}" >= "\\uFFFF") === false');
}
//CHECK#11
if (("\u{12345}" >= "\u{10000}") !== true) {
throw new Test262Error('#11: ("\\u{12345}" >= "\\u{10000}") === true');
}

View File

@ -5,7 +5,7 @@
info: |
If neither x, nor y is a prefix of each other, returned result of strings
comparison applies a simple lexicographic ordering to the sequences of
code point value values
code unit value values
es5id: 11.8.4_A4.12_T2
description: x and y are string primitives
---*/

View File

@ -5,7 +5,7 @@
info: |
If neither x, nor y is a prefix of each other, returned result of strings
comparison applies a simple lexicographic ordering to the sequences of
code point value values
code unit value values
es5id: 11.8.2_A4.12_T1
description: x and y are string primitives
---*/
@ -44,3 +44,25 @@ if (("a\u0000b" > "a\u0000a") !== true) {
if (("aa" > "aB") !== true) {
throw new Test262Error('#7: ("aa" > aB") === true');
}
//CHECK#8
if (("\u{10000}" > "\uD7FF") !== true) {
throw new Test262Error('#8: ("\\u{10000}" > "\\uD7FF") === true');
}
//CHECK#9
if (("\uDC00" > "\uD800") !== true) {
throw new Test262Error('#9: ("\\uDC00" > "\\uD800") === true');
}
//CHECK#10
// String comparison is done by code units, rather than by code points.
// "\u{10000}" is equivalent to "\uD800\uDC00"
if (("\u{10000}" > "\uFFFF") !== false) {
throw new Test262Error('#10: ("\\u{10000}" > "\\uFFFF") === false');
}
//CHECK#11
if (("\u{12345}" > "\u{10000}") !== true) {
throw new Test262Error('#11: ("\\u{12345}" > "\\u{10000}") === true');
}

View File

@ -5,7 +5,7 @@
info: |
If neither x, nor y is a prefix of each other, returned result of strings
comparison applies a simple lexicographic ordering to the sequences of
code point value values
code unit value values
es5id: 11.8.2_A4.12_T2
description: x and y are string primitives
---*/

View File

@ -5,7 +5,7 @@
info: |
If neither x, nor y is a prefix of each other, returned result of strings
comparison applies a simple lexicographic ordering to the sequences of
code point value values
code unit value values
es5id: 11.8.3_A4.12_T1
description: x and y are string primitives
---*/
@ -44,3 +44,25 @@ if (("a\u0000a" <= "a\u0000b") !== true) {
if (("aB" <= "aa") !== true) {
throw new Test262Error('#7: ("aB" <= aa") === true');
}
//CHECK#8
if (("\uD7FF" <= "\u{10000}") !== true) {
throw new Test262Error('#8: ("\\uD7FF" <= "\\u{10000}") === true');
}
//CHECK#9
if (("\uD800" <= "\uDC00") !== true) {
throw new Test262Error('#9: ("\\uD800" <= "\\uDC00") === true');
}
//CHECK#10
// String comparison is done by code units, rather than by code points.
// "\u{10000}" is equivalent to "\uD800\uDC00"
if (("\u{10000}" <= "\uFFFF") !== true) {
throw new Test262Error('#10: ("\\u{10000}" <= "\\uFFFF") === true');
}
//CHECK#11
if (("\u{10000}" <= "\u{12345}") !== true) {
throw new Test262Error('#11: ("\\u{10000}" <= "\\u{12345}") === true');
}

View File

@ -5,7 +5,7 @@
info: |
If neither x, nor y is a prefix of each other, returned result of strings
comparison applies a simple lexicographic ordering to the sequences of
code point value values
code unit value values
es5id: 11.8.3_A4.12_T2
description: x and y are string primitives
---*/

View File

@ -5,7 +5,7 @@
info: |
If neither x, nor y is a prefix of each other, returned result of strings
comparison applies a simple lexicographic ordering to the sequences of
code point value values
code unit value values
es5id: 11.8.1_A4.12_T1
description: x and y are string primitives
---*/
@ -44,3 +44,25 @@ if (("a\u0000a" < "a\u0000b") !== true) {
if (("aB" < "aa") !== true) {
throw new Test262Error('#7: ("aB" < aa") === true');
}
//CHECK#8
if (("\uD7FF" < "\u{10000}") !== true) {
throw new Test262Error('#8: ("\\uD7FF" < "\\u{10000}") === true');
}
//CHECK#9
if (("\uD800" < "\uDC00") !== true) {
throw new Test262Error('#9: ("\\uD800" < "\\uDC00") === true');
}
//CHECK#10
// String comparison is done by code units, rather than by code points.
// "\u{10000}" is equivalent to "\uD800\uDC00"
if (("\u{10000}" < "\uFFFF") !== true) {
throw new Test262Error('#10: ("\\u{10000}" < "\\uFFFF") === true');
}
//CHECK#11
if (("\u{10000}" < "\u{12345}") !== true) {
throw new Test262Error('#11: ("\\u{10000}" < "\\u{12345}") === true');
}

View File

@ -5,7 +5,7 @@
info: |
If neither x, nor y is a prefix of each other, returned result of strings
comparison applies a simple lexicographic ordering to the sequences of
code point value values
code unit value values
es5id: 11.8.1_A4.12_T2
description: x and y are string primitives
---*/