Skip to content

Commit d8b4c56

Browse files
authored
Test StringLowering with a surrogate pair (#7415)
We tested isolated surrogates, but we did not test with a valid surrogate pair.
1 parent a12de94 commit d8b4c56

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/lit/passes/string-lowering.wast

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
(drop
1717
(string.const "needs\tescaping\00.'#%\"- .\r\n\\08\0C\0A\0D\09.ꙮ")
1818
)
19+
(drop
20+
;; GOTHIC LETTER HWAIR: 𐍈 has code point 0x10348 and is \uD800 \uDF48 in UTF-16.
21+
(string.const "surrogate pair \F0\90\8D\88 ")
22+
)
1923
(drop
2024
(string.const "unpaired high surrogate \ED\A0\80 ")
2125
)
@@ -40,7 +44,7 @@
4044
;; RUN: not wasm-opt %s --string-lowering-magic-imports-assert -all -S -o - \
4145
;; RUN: 2>&1 | filecheck %s --check-prefix=ASSERT
4246
;;
43-
;; CHECK: custom section "string.consts", size 136, contents: "[\"bar\",\"foo\",\"needs\\tescaping\\u0000.'#%\\\"- .\\r\\n\\\\08\\f\\n\\r\\t.\\ua66e\",\"unpaired high surrogate \\ud800 \",\"unpaired low surrogate \\udf48 \"]"
47+
;; CHECK: custom section "string.consts", size 167, contents: "[\"bar\",\"foo\",\"needs\\tescaping\\u0000.'#%\\\"- .\\r\\n\\\\08\\f\\n\\r\\t.\\ua66e\",\"surrogate pair \\ud800\\udf48 \",\"unpaired high surrogate \\ud800 \",\"unpaired low surrogate \\udf48 \"]"
4448
;;
4549
;; MAGIC: custom section "string.consts", size 68, contents: "[\"unpaired high surrogate \\ud800 \",\"unpaired low surrogate \\udf48 \"]"
4650
;;
@@ -53,6 +57,6 @@
5357
;; RUN: wasm-opt %s --string-lowering --remove-unused-module-elements -all -o %t.wasm
5458
;; RUN: node %S/string-lowering.js %t.wasm | filecheck %s --check-prefix=CHECK-JS
5559
;;
56-
;; CHECK-JS: string: ["bar","foo","needs\tescaping\x00.'#%\"- .\r\n\\08\f\n\r\t.\ua66e","unpaired high surrogate \ud800 ","unpaired low surrogate \udf48 "]
60+
;; CHECK-JS: string: ["bar","foo","needs\tescaping\x00.'#%\"- .\r\n\\08\f\n\r\t.\ua66e","surrogate pair \ud800\udf48 ","unpaired high surrogate \ud800 ","unpaired low surrogate \udf48 "]
5761
;;
58-
;; CHECK-JS: JSON: ["bar","foo","needs\tescaping\x00.'#%\"- .\r\n\\08\f\n\r\t.ꙮ","unpaired high surrogate \ud800 ","unpaired low surrogate \udf48 "]
62+
;; CHECK-JS: JSON: ["bar","foo","needs\tescaping\x00.'#%\"- .\r\n\\08\f\n\r\t.ꙮ","surrogate pair 𐍈 ","unpaired high surrogate \ud800 ","unpaired low surrogate \udf48 "]

0 commit comments

Comments
 (0)