summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lit/strings.wast57
1 files changed, 55 insertions, 2 deletions
diff --git a/test/lit/strings.wast b/test/lit/strings.wast
index 03e87e562..e201b2bd7 100644
--- a/test/lit/strings.wast
+++ b/test/lit/strings.wast
@@ -11,6 +11,9 @@
;; CHECK: (type $stringref_stringref_=>_none (func (param stringref stringref)))
+ ;; CHECK: (type $array (array i32))
+ (type $array (array_subtype i32 data))
+
;; CHECK: (type $stringref_stringview_wtf8_stringview_wtf16_stringview_iter_stringref_stringview_wtf8_stringview_wtf16_stringview_iter_ref|string|_ref|stringview_wtf8|_ref|stringview_wtf16|_ref|stringview_iter|_=>_none (func (param stringref stringview_wtf8 stringview_wtf16 stringview_iter stringref stringview_wtf8 stringview_wtf16 stringview_iter (ref string) (ref stringview_wtf8) (ref stringview_wtf16) (ref stringview_iter))))
;; CHECK: (type $none_=>_none (func))
@@ -19,8 +22,7 @@
;; CHECK: (type $ref|$array|_=>_none (func (param (ref $array))))
- ;; CHECK: (type $array (array i32))
- (type $array (array_subtype i32 data))
+ ;; CHECK: (type $stringref_ref|$array|_=>_none (func (param stringref (ref $array))))
;; CHECK: (global $string-const stringref (string.const "string in a global"))
(global $string-const stringref (string.const "string in a global"))
@@ -475,4 +477,55 @@
)
)
)
+
+ ;; CHECK: (func $string.encode.gc (param $ref stringref) (param $array (ref $array))
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.eqz
+ ;; CHECK-NEXT: (string.encode_wtf8_array wtf8
+ ;; CHECK-NEXT: (local.get $ref)
+ ;; CHECK-NEXT: (local.get $array)
+ ;; CHECK-NEXT: (i32.const 10)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (string.encode_wtf8_array utf8
+ ;; CHECK-NEXT: (local.get $ref)
+ ;; CHECK-NEXT: (local.get $array)
+ ;; CHECK-NEXT: (i32.const 20)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (string.encode_wtf16_array
+ ;; CHECK-NEXT: (local.get $ref)
+ ;; CHECK-NEXT: (local.get $array)
+ ;; CHECK-NEXT: (i32.const 30)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $string.encode.gc (param $ref stringref) (param $array (ref $array))
+ (drop
+ (i32.eqz ;; validate the output is i32
+ (string.encode_wtf8_array wtf8
+ (local.get $ref)
+ (local.get $array)
+ (i32.const 10)
+ )
+ )
+ )
+ (drop
+ (string.encode_wtf8_array utf8
+ (local.get $ref)
+ (local.get $array)
+ (i32.const 20)
+ )
+ )
+ (drop
+ (string.encode_wtf16_array
+ (local.get $ref)
+ (local.get $array)
+ (i32.const 30)
+ )
+ )
+ )
)