lib/rib/test/multiline.rb in rib-1.6.0 vs lib/rib/test/multiline.rb in rib-1.6.1
- old
+ new
@@ -23,10 +23,12 @@
shell.loop_once
ok
end
def check str, err=nil
+ yield if block_given?
+
lines = str.split("\n")
lines[0...-1].each{ |line|
input(line)
shell.loop_once
}
@@ -133,13 +135,21 @@
'
RUBY
end
would 'be hash treated as a block SyntaxError' do
- check <<~RUBY, SyntaxError
+ code = <<~RUBY
puts { :x => 10 }.class
RUBY
+
+ if RUBY_VERSION >= '3.0.0'
+ check code do
+ stub(shell.config[:binding_object]).puts{}
+ end
+ else
+ check code, SyntaxError
+ end
end
would 'SyntaxError' do
check <<~RUBY, SyntaxError
s-y n
@@ -173,13 +183,19 @@
1
RUBY
end
would 'binary operator /' do
- check <<~RUBY
+ code = <<~RUBY
1+1.to_i /
1
RUBY
+
+ if RUBY_VERSION >= '3.0.0'
+ check code.lines.first, SyntaxError
+ else
+ check code
+ end
end
would 'binary operator |' do
check <<~RUBY
1+1.to_i |