2 # This test is in a differnt file than TestUnicodeEscapes
3 # So that we can have a different coding comment above
7 class TestMixedUnicodeEscape < Test::Unit::TestCase
9 # Unicode escapes do work in an sjis encoded file, but only
10 # if they don't contain other multi-byte chars
11 assert_equal("A", "\u0041")
12 # 8-bit character escapes are okay.
13 assert_equal("B\xFF", "\u0042\xFF")
15 # sjis mb chars mixed with Unicode shound not work
16 assert_raise(SyntaxError) { eval %q("é�\u1234")}
17 assert_raise(SyntaxError) { eval %q("\u{1234}é�")}
19 # String interpolation turns into an expression and we get
20 # a different kind of error, but we still can't mix these
21 assert_raise(ArgumentError) { eval %q("\u{1234}#{nil}é�")}
22 assert_raise(ArgumentError) { eval %q("é�#{nil}\u1234")}