summaryrefslogtreecommitdiff
path: root/test/lit/strings.wast
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-07-07 10:32:57 -0700
committerGitHub <noreply@github.com>2022-07-07 10:32:57 -0700
commitdc73f07807400eb48b8c4bc173bae37f188fc90b (patch)
treeed9672cb7847c6d9d33657151dc76fa4cb519ff3 /test/lit/strings.wast
parent876638f8fb5bfc8b264eddc6c0c0d54ed40d0095 (diff)
downloadbinaryen-dc73f07807400eb48b8c4bc173bae37f188fc90b.tar.gz
binaryen-dc73f07807400eb48b8c4bc173bae37f188fc90b.tar.bz2
binaryen-dc73f07807400eb48b8c4bc173bae37f188fc90b.zip
[Strings] string.measure (#4775)
Diffstat (limited to 'test/lit/strings.wast')
-rw-r--r--test/lit/strings.wast41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/lit/strings.wast b/test/lit/strings.wast
index 7436a04b9..9776b569f 100644
--- a/test/lit/strings.wast
+++ b/test/lit/strings.wast
@@ -9,6 +9,8 @@
;; CHECK: (type $none_=>_none (func))
+ ;; CHECK: (type $ref?|string|_=>_none (func (param stringref)))
+
;; CHECK: (global $string-const stringref (string.const "string in a global"))
(global $string-const stringref (string.const "string in a global"))
@@ -99,4 +101,43 @@
(string.const "bar")
)
)
+
+ ;; CHECK: (func $string.measure (param $ref stringref)
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.eqz
+ ;; CHECK-NEXT: (string.measure_wtf8 wtf8
+ ;; CHECK-NEXT: (local.get $ref)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (string.measure_wtf8 utf8
+ ;; CHECK-NEXT: (local.get $ref)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (string.measure_wtf16
+ ;; CHECK-NEXT: (local.get $ref)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $string.measure (param $ref stringref)
+ (drop
+ (i32.eqz ;; validate the output is i32
+ (string.measure_wtf8 wtf8
+ (local.get $ref)
+ )
+ )
+ )
+ (drop
+ (string.measure_wtf8 utf8
+ (local.get $ref)
+ )
+ )
+ (drop
+ (string.measure_wtf16
+ (local.get $ref)
+ )
+ )
+ )
)