From dc73f07807400eb48b8c4bc173bae37f188fc90b Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 7 Jul 2022 10:32:57 -0700 Subject: [Strings] string.measure (#4775) --- test/lit/strings.wast | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'test') 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) + ) + ) + ) ) -- cgit v1.2.3