diff options
Diffstat (limited to 'test/lit/passes/precompute-strings.wast')
-rw-r--r-- | test/lit/passes/precompute-strings.wast | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/lit/passes/precompute-strings.wast b/test/lit/passes/precompute-strings.wast index aa138b289..f70430648 100644 --- a/test/lit/passes/precompute-strings.wast +++ b/test/lit/passes/precompute-strings.wast @@ -129,4 +129,33 @@ (i32.const 0) ) ) + + ;; CHECK: (func $slice (type $1) (result (ref string)) + ;; CHECK-NEXT: (string.const "def") + ;; CHECK-NEXT: ) + (func $slice (export "slice") (result (ref string)) + ;; Slicing [3:6] here should definitely output "def". + (stringview_wtf16.slice + (string.const "abcdefgh") + (i32.const 3) + (i32.const 6) + ) + ) + + ;; CHECK: (func $slice-bad (type $1) (result (ref string)) + ;; CHECK-NEXT: (stringview_wtf16.slice + ;; CHECK-NEXT: (string.const "abcd\c2\a3fgh") + ;; CHECK-NEXT: (i32.const 3) + ;; CHECK-NEXT: (i32.const 6) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $slice-bad (export "slice-bad") (result (ref string)) + ;; This slice contains non-ascii, so we do not optimize. + (stringview_wtf16.slice + ;; abcd£fgh + (string.const "abcd\C2\A3fgh") + (i32.const 3) + (i32.const 6) + ) + ) ) |