1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Indented here document (<<~) is Ruby 2.3 feature

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2019-01-19 07:49:47 +00:00
parent 405940234e
commit e90d826de7

View file

@ -28,20 +28,20 @@ tests = [
[ 'getlocal *, 1', %q{ x = true; -> { x }.call }, ],
[ 'getlocal', %q{ x = true; -> { -> { x }.() }.() }, ],
[ 'setblockparam', <<~'},', ], # {
[ 'setblockparam', <<-'},', ], # {
def m&b
b = # here
proc { true }
end
m { false }.call
},
[ 'getblockparam', <<~'},', ], # {
[ 'getblockparam', <<-'},', ], # {
def m&b
b # here
end
m { true }.call
},
[ 'getblockparamproxy', <<~'},', ], # {
[ 'getblockparamproxy', <<-'},', ], # {
def m&b
b # here
.call
@ -101,11 +101,11 @@ tests = [
[ 'expandarray', %q{ y = [ true, false, nil ]; x, *z, w = y; x }, ],
[ 'splatarray', %q{ x, = *(y = true), false; x }, ],
[ 'concatarray', %q{ ["t", "r", *x = "u", "e"].join }, ],
[ 'concatarray', <<~'},', ], # {
[ 'concatarray', <<-'},', ], # {
class X; def to_a; ['u']; end; end
['t', 'r', *X.new, 'e'].join
},
[ 'concatarray', <<~'},', ], # {
[ 'concatarray', <<-'},', ], # {
r = false
t = [true, nil]
q, w, e = r, *t # here
@ -122,7 +122,7 @@ tests = [
[ 'dup', %q{ x = y = true; x }, ],
[ 'dupn', %q{ Object::X ||= true }, ],
[ 'reverse', %q{ q, (w, e), r = 1, [2, 3], 4; e == 3 }, ],
[ 'swap', <<~'},', ], # {
[ 'swap', <<-'},', ], # {
x = [[false, true]]
for i, j in x # here
;
@ -137,7 +137,7 @@ tests = [
[ 'defined', %q{ !defined?(x) }, ],
[ 'checkkeyword', %q{ def x x:rand;x end; x x: true }, ],
[ 'checktype', %q{ x = true; "#{x}" }, ],
[ 'checkmatch', <<~'},', ], # {
[ 'checkmatch', <<-'},', ], # {
x = y = true
case x
when false
@ -147,7 +147,7 @@ tests = [
end
y == nil
},
[ 'checkmatch', <<~'},', ], # {
[ 'checkmatch', <<-'},', ], # {
x, y = true, [false]
case x
when *y # here
@ -157,7 +157,7 @@ tests = [
end
z
},
[ 'checkmatch', <<~'},', ], # {
[ 'checkmatch', <<-'},', ], # {
x = false
begin
raise
@ -173,7 +173,7 @@ tests = [
[ 'defineclass', %q{ X = Class.new; class X; true end }, ],
[ 'defineclass', %q{ X = Class.new; class Y < X; true end }, ],
[ 'defineclass', %q{ X = Class.new; class << X; true end }, ],
[ 'defineclass', <<~'},', ], # {
[ 'defineclass', <<-'},', ], # {
X = Class.new
Y = Class.new(X)
class Y < X
@ -184,7 +184,7 @@ tests = [
[ 'opt_send_without_block', %q{ true.to_s }, ],
[ 'send', %q{ true.tap {|i| i.to_s } }, ],
[ 'leave', %q{ def x; true; end; x }, ],
[ 'invokesuper', <<~'},', ], # {
[ 'invokesuper', <<-'},', ], # {
class X < String
def empty?
super # here
@ -192,7 +192,7 @@ tests = [
end
X.new.empty?
},
[ 'invokeblock', <<~'},', ], # {
[ 'invokeblock', <<-'},', ], # {
def x
return yield self # here
end
@ -203,7 +203,7 @@ tests = [
[ 'opt_str_freeze', %q{ 'true'.freeze }, ],
[ 'opt_str_uminus', %q{ -'true' }, ],
[ 'opt_str_freeze', <<~'},', ], # {
[ 'opt_str_freeze', <<-'},', ], # {
class String
def freeze
true
@ -214,7 +214,7 @@ tests = [
[ 'opt_newarray_max', %q{ [ ].max.nil? }, ],
[ 'opt_newarray_max', %q{ [1, x = 2, 3].max == 3 }, ],
[ 'opt_newarray_max', <<~'},', ], # {
[ 'opt_newarray_max', <<-'},', ], # {
class Array
def max
true
@ -224,7 +224,7 @@ tests = [
},
[ 'opt_newarray_min', %q{ [ ].min.nil? }, ],
[ 'opt_newarray_min', %q{ [3, x = 2, 1].min == 1 }, ],
[ 'opt_newarray_min', <<~'},', ], # {
[ 'opt_newarray_min', <<-'},', ], # {
class Array
def min
true
@ -240,12 +240,12 @@ tests = [
[ 'branchunless', %q{ x = nil; x &&= true; x.nil? }, ],
[ 'branchnil', %q{ x = true; x&.to_s }, ],
[ 'branchnil', %q{ x = nil; (x&.to_s).nil? }, ],
[ 'jump', <<~'},', ], # {
[ 'jump', <<-'},', ], # {
y = 1
x = if y == 0 then nil elsif y == 1 then true else nil end
x
},
[ 'jump', <<~'},', ], # {
[ 'jump', <<-'},', ], # {
# ultra complicated situation: this ||= assignment only generates
# 15 instructions, not including the class definition.
class X; attr_accessor :x; end
@ -254,14 +254,14 @@ tests = [
},
[ 'once', %q{ /#{true}/o =~ "true" && $~ }, ],
[ 'once', <<~'},', ], # {
[ 'once', <<-'},', ], # {
def once expr
return /#{expr}/o # here
end
x = once(true); x = once(false); x = once(nil);
x =~ "true" && $~
},
[ 'once', <<~'},', ], # {
[ 'once', <<-'},', ], # {
# recursive once
def once n
return %r/#{
@ -275,7 +275,7 @@ tests = [
x = once(128); x = once(7); x = once(16);
x =~ "true" && $~
},
[ 'once', <<~'},', ], # {
[ 'once', <<-'},', ], # {
# inter-thread lockup situation
def once n
return Thread.start n do |m|
@ -323,12 +323,12 @@ tests = [
[ 'opt_mod', %q{ '%s' % [ true ] }, ],
[ 'opt_eq', %q{ 1 == 1 }, ],
[ 'opt_eq', <<~'},', ], # {
[ 'opt_eq', <<-'},', ], # {
class X; def == other; true; end; end
X.new == true
},
[ 'opt_neq', %q{ 1 != 0 }, ],
[ 'opt_neq', <<~'},', ], # {
[ 'opt_neq', <<-'},', ], # {
class X; def != other; true; end; end
X.new != true
},
@ -360,7 +360,7 @@ tests = [
[ 'opt_aset', %q{ [][0] = true }, ],
[ 'opt_aset', %q{ {}[0] = true }, ],
[ 'opt_aset', %q{ x = 'frue'; x[0] = 't'; x }, ],
[ 'opt_aset', <<~'},', ], # {
[ 'opt_aset', <<-'},', ], # {
# opt_aref / opt_aset mixup situation
class X; def x; {}; end; end
x = X.new
@ -393,18 +393,18 @@ tests = [
[ 'opt_succ', %q{ x = Time.at(0); x.succ == Time.at(1) }, ],
[ 'opt_not', %q{ ! false }, ],
[ 'opt_neq', <<~'},', ], # {
[ 'opt_neq', <<-'},', ], # {
class X; def !; true; end; end
! X.new
},
[ 'opt_regexpmatch1', %q{ /true/ =~ 'true' && $~ }, ],
[ 'opt_regexpmatch1', <<~'},', ], # {
[ 'opt_regexpmatch1', <<-'},', ], # {
class Regexp; def =~ other; true; end; end
/true/ =~ 'true'
},
[ 'opt_regexpmatch2', %q{ 'true' =~ /true/ && $~ }, ],
[ 'opt_regexpmatch2', <<~'},', ], # {
[ 'opt_regexpmatch2', <<-'},', ], # {
class String; def =~ other; true; end; end
'true' =~ /true/
},