diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-09-25 18:02:00 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-09-25 18:02:00 -0700 |
| commit | 11b0dda641f3334e8a34eaa349a6e5becf864d94 (patch) | |
| tree | c60523800cda188c316aae2870a3fffa04707629 /test | |
| parent | 9194047791bede575a184620ed9a96edd26b24ac (diff) | |
| parent | 8d34e00102a6ba39b57960e653b0d7b6b3428006 (diff) | |
| download | mruby-11b0dda641f3334e8a34eaa349a6e5becf864d94.tar.gz mruby-11b0dda641f3334e8a34eaa349a6e5becf864d94.zip | |
Merge pull request #1509 from FUKUZAWA-Tadashi/heredoc-bugfix
fix bugs on Heredocument
Diffstat (limited to 'test')
| -rw-r--r-- | test/t/literals.rb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/t/literals.rb b/test/t/literals.rb index 524ceb440..5bf6d6e06 100644 --- a/test/t/literals.rb +++ b/test/t/literals.rb @@ -138,6 +138,46 @@ FFF 123 KKK + m = [<<MM1, <<MM2] +x#{m2 = {x:<<MM3}}y +mm3 +MM3 +mm1 +MM1 +mm2 +MM2 + + n = [1, "#{<<NN1}", 3, +nn1 +NN1 + 4] + + qqq = Proc.new {|*x| x.join(' $ ')} + q1 = qqq.call("a", <<QQ1, "c", +q +QQ1 + "d") + q2 = qqq.call("l", "m#{<<QQ2}n", +qq +QQ2 + "o") + + w = %W( 1 #{<<WWW} 3 +www +WWW + 4 5 ) + + x = [1, <<XXX1, +foo #{<<XXX2} bar +222 #{<<XXX3} 444 +333 +XXX3 +5 +XXX2 +6 +XXX1 + 9] + z = <<'ZZZ' ZZZ @@ -152,9 +192,18 @@ ZZZ assert_equal " iii\n", i assert_equal [" j1j\n", " j2j\n", " j\#{3}j\n"], j assert_equal 123, k + assert_equal ["x{:x=>\"mm3\\n\"}y\nmm1\n", "mm2\n"], m + assert_equal ({:x=>"mm3\n"}), m2 + assert_equal [1, "nn1\n", 3, 4], n + assert_equal "a $ q\n $ c $ d", q1 + assert_equal "l $ mqq\nn $ o", q2 + assert_equal ["1", "www\n", "3", "4", "5"], w + assert_equal [1, "foo 222 333\n 444\n5\n bar\n6\n", 9], x assert_equal "", z + end + assert('Literals Array', '8.7.6.4') do a = %W{abc#{1+2}def \}g} b = %W(abc #{2+3} def \(g) @@ -209,6 +258,7 @@ d assert_equal ["a\\nb", "test abc", "c\nd", "x\\y", "x\\y", "x\\\\y"], h end + assert('Literals Array of symbols') do a = %I{abc#{1+2}def \}g} b = %I(abc #{2+3} def \(g) |
