summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-07-18 15:50:22 -0700
committerGitHub <noreply@github.com>2022-07-18 22:50:22 +0000
commit6bac16b3895d6d94007fcdc5c098d52ba2a408e5 (patch)
tree4bd055a212e48e5e8d65cc601174d185d2937eb8 /test
parent2b31aeb98a0fc8a5a505b3998d44990ed14e8c38 (diff)
downloadbinaryen-6bac16b3895d6d94007fcdc5c098d52ba2a408e5.tar.gz
binaryen-6bac16b3895d6d94007fcdc5c098d52ba2a408e5.tar.bz2
binaryen-6bac16b3895d6d94007fcdc5c098d52ba2a408e5.zip
[Strings] stringview_wtf16.length (#4809)
This measures the length of a view, so it seems simplest to make it a sub-operation of the existing measure instruction.
Diffstat (limited to 'test')
-rw-r--r--test/lit/strings.wast21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/lit/strings.wast b/test/lit/strings.wast
index 1b2d77bd8..25ec73326 100644
--- a/test/lit/strings.wast
+++ b/test/lit/strings.wast
@@ -15,6 +15,8 @@
;; CHECK: (type $none_=>_none (func))
+ ;; CHECK: (type $ref?|stringview_wtf16|_=>_none (func (param stringview_wtf16)))
+
;; CHECK: (global $string-const stringref (string.const "string in a global"))
(global $string-const stringref (string.const "string in a global"))
@@ -404,4 +406,23 @@
)
)
)
+
+ ;; CHECK: (func $string.length (param $ref stringview_wtf16)
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.eqz
+ ;; CHECK-NEXT: (stringview_wtf16.length
+ ;; CHECK-NEXT: (local.get $ref)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $string.length (param $ref stringview_wtf16)
+ (drop
+ (i32.eqz ;; validate the output is i32
+ (stringview_wtf16.length
+ (local.get $ref)
+ )
+ )
+ )
+ )
)