summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-03-18 19:38:38 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2013-03-18 19:38:38 -0700
commit99b5d43a0bef6838a00aee54e5516da18c4aa3f9 (patch)
treefee62d7f3be856a78e4360fbc830a96f76670a03 /test
parent5217d889633fc556458b2327c30ba483e02ce6d7 (diff)
parentcdf8114e27288612139b544a6dea34e33217c88c (diff)
downloadmruby-99b5d43a0bef6838a00aee54e5516da18c4aa3f9.tar.gz
mruby-99b5d43a0bef6838a00aee54e5516da18c4aa3f9.zip
Merge pull request #1031 from FUKUZAWA-Tadashi/iI
implement %I %i literal
Diffstat (limited to 'test')
-rw-r--r--test/t/literals.rb48
1 files changed, 47 insertions, 1 deletions
diff --git a/test/t/literals.rb b/test/t/literals.rb
index 5a29cff0c..f40852ff9 100644
--- a/test/t/literals.rb
+++ b/test/t/literals.rb
@@ -186,8 +186,54 @@ d
test1 and test2
end
+assert('Literals Array of symbols') do
+ a = %I{abc#{1+2}def \}g}
+ b = %I(abc #{2+3} def \(g)
+ c = %I[#{3+4}]
+ d = %I< #{4+5} >
+ e = %I//
+ f = %I[[ab cd][ef]]
+ g = %I{
+ ab
+ #{-1}1
+ 2#{2}
+ }
+
+ test1 = (a == [:'abc3def', :'}g'] and
+ b == [:'abc', :'5', :'def', :'(g'] and
+ c == [:'7'] and
+ d == [:'9'] and
+ e == [] and
+ f == [:'[ab', :'cd][ef]'] and
+ g == [:'ab', :'-11', :'22']
+ )
+
+ a = %i{abc#{1+2}def \}g}
+ b = %i(abc #{2+3} def \(g)
+ c = %i[#{3+4}]
+ d = %i< #{4+5} >
+ e = %i//
+ f = %i[[ab cd][ef]]
+ g = %i{
+ ab
+ #{-1}1
+ 2#{2}
+ }
+
+ test2 = (a == [:'abc#{1+2}def', :'}g'] and
+ b == [:'abc', :'#{2+3}', :'def', :'(g'] and
+ c == [:'#{3+4}'] and
+ d == [:'#{4+5}'] and
+ e == [] and
+ f == [:'[ab', :'cd][ef]'] and
+ g == [:'ab', :'#{-1}1', :'2#{2}']
+ )
+
+ test1 and test2
+end
+
assert('Literals Symbol', '8.7.6.6') do
- /* do not compile error */
+ # do not compile error
:$asd
:@asd
:@@asd