summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lit/help/wasm-metadce.test5
-rw-r--r--test/lit/help/wasm-opt.test5
-rw-r--r--test/lit/help/wasm2js.test5
-rw-r--r--test/lit/passes/string-lowering.wast7
4 files changed, 22 insertions, 0 deletions
diff --git a/test/lit/help/wasm-metadce.test b/test/lit/help/wasm-metadce.test
index c40f2e22b..e25a0214d 100644
--- a/test/lit/help/wasm-metadce.test
+++ b/test/lit/help/wasm-metadce.test
@@ -478,6 +478,11 @@
;; CHECK-NEXT: encodes well-formed strings as
;; CHECK-NEXT: magic imports
;; CHECK-NEXT:
+;; CHECK-NEXT: --string-lowering-magic-imports-assert same as
+;; CHECK-NEXT: string-lowering-magic-imports,
+;; CHECK-NEXT: but raise a fatal error if there
+;; CHECK-NEXT: are invalid strings
+;; CHECK-NEXT:
;; CHECK-NEXT: --strip deprecated; same as strip-debug
;; CHECK-NEXT:
;; CHECK-NEXT: --strip-debug strip debug info (including the
diff --git a/test/lit/help/wasm-opt.test b/test/lit/help/wasm-opt.test
index a1df2640a..3a577099b 100644
--- a/test/lit/help/wasm-opt.test
+++ b/test/lit/help/wasm-opt.test
@@ -487,6 +487,11 @@
;; CHECK-NEXT: encodes well-formed strings as
;; CHECK-NEXT: magic imports
;; CHECK-NEXT:
+;; CHECK-NEXT: --string-lowering-magic-imports-assert same as
+;; CHECK-NEXT: string-lowering-magic-imports,
+;; CHECK-NEXT: but raise a fatal error if there
+;; CHECK-NEXT: are invalid strings
+;; CHECK-NEXT:
;; CHECK-NEXT: --strip deprecated; same as strip-debug
;; CHECK-NEXT:
;; CHECK-NEXT: --strip-debug strip debug info (including the
diff --git a/test/lit/help/wasm2js.test b/test/lit/help/wasm2js.test
index beefdbbd7..3c0a17e7a 100644
--- a/test/lit/help/wasm2js.test
+++ b/test/lit/help/wasm2js.test
@@ -441,6 +441,11 @@
;; CHECK-NEXT: encodes well-formed strings as
;; CHECK-NEXT: magic imports
;; CHECK-NEXT:
+;; CHECK-NEXT: --string-lowering-magic-imports-assert same as
+;; CHECK-NEXT: string-lowering-magic-imports,
+;; CHECK-NEXT: but raise a fatal error if there
+;; CHECK-NEXT: are invalid strings
+;; CHECK-NEXT:
;; CHECK-NEXT: --strip deprecated; same as strip-debug
;; CHECK-NEXT:
;; CHECK-NEXT: --strip-debug strip debug info (including the
diff --git a/test/lit/passes/string-lowering.wast b/test/lit/passes/string-lowering.wast
index de684889a..0182082f4 100644
--- a/test/lit/passes/string-lowering.wast
+++ b/test/lit/passes/string-lowering.wast
@@ -35,9 +35,16 @@
;; RUN: wasm-opt %s --string-lowering-magic-imports -all -S -o - \
;; RUN: | filecheck %s --check-prefix=MAGIC
;;
+;; If we use magic imports with asserts, we should get an error.
+;;
+;; RUN: not wasm-opt %s --string-lowering-magic-imports-assert -all -S -o - \
+;; RUN: 2>&1 | filecheck %s --check-prefix=ASSERT
+;;
;; 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 \"]"
;;
;; MAGIC: custom section "string.consts", size 68, contents: "[\"unpaired high surrogate \\ud800 \",\"unpaired low surrogate \\udf48 \"]"
+;;
+;; ASSERT: Fatal: Cannot lower non-UTF-16 string "unpaired high surrogate \ef\bf\bd "
;; The custom section should parse OK using JSON.parse from node.
;; (Note we run --remove-unused-module-elements to remove externref-using