summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorFUKUZAWA-Tadashi <[email protected]>2013-03-14 23:05:05 +0900
committerFUKUZAWA-Tadashi <[email protected]>2013-03-19 00:41:15 +0900
commitcdf8114e27288612139b544a6dea34e33217c88c (patch)
treefee62d7f3be856a78e4360fbc830a96f76670a03 /test
parent5217d889633fc556458b2327c30ba483e02ce6d7 (diff)
downloadmruby-cdf8114e27288612139b544a6dea34e33217c88c.tar.gz
mruby-cdf8114e27288612139b544a6dea34e33217c88c.zip
%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