diff --git a/test/core/names.wast b/test/core/names.wast index 9c53234cf0..be9877976b 100644 --- a/test/core/names.wast +++ b/test/core/names.wast @@ -1092,6 +1092,17 @@ (assert_return (invoke "ϔ") (i32.const 477)) (assert_return (invoke "ẛ") (i32.const 478)) +(module + ;; Test the escapes \r, \' and \u{...} with an underscore in names. + (func (export "\r") (result i32) (i32.const 0)) + (func (export "\'") (result i32) (i32.const 1)) + (func (export "\u{1_F600}") (result i32) (i32.const 2)) +) + +(assert_return (invoke "\0d") (i32.const 0)) +(assert_return (invoke "'") (i32.const 1)) +(assert_return (invoke "\f0\9f\98\80") (i32.const 2)) + (module ;; Test that we can use indices instead of names to reference imports, ;; exports, functions and parameters. diff --git a/test/core/utf8-invalid-encoding.wast b/test/core/utf8-invalid-encoding.wast index b7d95b7ec8..01e49e7632 100644 --- a/test/core/utf8-invalid-encoding.wast +++ b/test/core/utf8-invalid-encoding.wast @@ -196,3 +196,18 @@ (module quote "(func (export \"\\u{00D800}\"))") "malformed UTF-8 codepoint" ) + +;; An underscore in a \u{...} escape must be between two hex digits. + +(assert_malformed + (module quote "(func (export \"\\u{_1F600}\"))") + "illegal escape" +) +(assert_malformed + (module quote "(func (export \"\\u{1F600_}\"))") + "illegal escape" +) +(assert_malformed + (module quote "(func (export \"\\u{1__F600}\"))") + "illegal escape" +)