summaryrefslogtreecommitdiff
path: root/spec/ruby/language/precedence_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/language/precedence_spec.rb')
-rw-r--r--spec/ruby/language/precedence_spec.rb36
1 files changed, 18 insertions, 18 deletions
diff --git a/spec/ruby/language/precedence_spec.rb b/spec/ruby/language/precedence_spec.rb
index c5adcca2c0..edb990525e 100644
--- a/spec/ruby/language/precedence_spec.rb
+++ b/spec/ruby/language/precedence_spec.rb
@@ -251,12 +251,12 @@ describe "Operators" do
end
it "<=> == === != =~ !~ are non-associative" do
- -> { eval("1 <=> 2 <=> 3") }.should raise_error(SyntaxError)
- -> { eval("1 == 2 == 3") }.should raise_error(SyntaxError)
- -> { eval("1 === 2 === 3") }.should raise_error(SyntaxError)
- -> { eval("1 != 2 != 3") }.should raise_error(SyntaxError)
- -> { eval("1 =~ 2 =~ 3") }.should raise_error(SyntaxError)
- -> { eval("1 !~ 2 !~ 3") }.should raise_error(SyntaxError)
+ -> { eval("1 <=> 2 <=> 3") }.should.raise(SyntaxError)
+ -> { eval("1 == 2 == 3") }.should.raise(SyntaxError)
+ -> { eval("1 === 2 === 3") }.should.raise(SyntaxError)
+ -> { eval("1 != 2 != 3") }.should.raise(SyntaxError)
+ -> { eval("1 =~ 2 =~ 3") }.should.raise(SyntaxError)
+ -> { eval("1 !~ 2 !~ 3") }.should.raise(SyntaxError)
end
it "<=> == === != =~ !~ have higher precedence than &&" do
@@ -290,18 +290,18 @@ describe "Operators" do
end
it ".. ... are non-associative" do
- -> { eval("1..2..3") }.should raise_error(SyntaxError)
- -> { eval("1...2...3") }.should raise_error(SyntaxError)
- end
-
- it ".. ... have higher precedence than ? :" do
- # Use variables to avoid warnings
- from = 1
- to = 2
- # These are flip-flop, not Range instances
- (from..to ? 3 : 4).should == 3
- (from...to ? 3 : 4).should == 3
- end
+ -> { eval("1..2..3") }.should.raise(SyntaxError)
+ -> { eval("1...2...3") }.should.raise(SyntaxError)
+ end
+
+ it ".. ... have higher precedence than ? :" do
+ # Use variables to avoid warnings
+ from = 1
+ to = 2
+ # These are flip-flop, not Range instances
+ (from..to ? 3 : 4).should == 3
+ (from...to ? 3 : 4).should == 3
+ end
it "? : is right-associative" do
(true ? 2 : 3 ? 4 : 5).should == 2