From cdf8114e27288612139b544a6dea34e33217c88c Mon Sep 17 00:00:00 2001 From: FUKUZAWA-Tadashi Date: Thu, 14 Mar 2013 23:05:05 +0900 Subject: %I %i literal --- test/t/literals.rb | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'test') 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 -- cgit v1.2.3