File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,24 @@ def test_invalid_message_name
6464 assert_equal :"" , Prism . parse_statement ( "+.@foo,+=foo" ) . write_name
6565 end
6666
67+ def test_regexp_encoding_option_mismatch_error
68+ # UTF-8 char with ASCII-8BIT modifier
69+ result = Prism . parse ( '/Ȃ/n' )
70+ assert_includes result . errors . map ( &:type ) , :regexp_encoding_option_mismatch
71+
72+ # UTF-8 char with EUC-JP modifier
73+ result = Prism . parse ( '/Ȃ/e' )
74+ assert_includes result . errors . map ( &:type ) , :regexp_encoding_option_mismatch
75+
76+ # UTF-8 char with Windows-31J modifier
77+ result = Prism . parse ( '/Ȃ/s' )
78+ assert_includes result . errors . map ( &:type ) , :regexp_encoding_option_mismatch
79+
80+ # UTF-8 char with UTF-8 modifier
81+ result = Prism . parse ( '/Ȃ/u' )
82+ assert_empty result . errors
83+ end
84+
6785 private
6886
6987 def assert_errors ( filepath , version )
You can’t perform that action at this time.
0 commit comments