Skip to content

Commit

Permalink
Uncomment old spec testing the precedence of ? : and .. ...
Browse files Browse the repository at this point in the history
* Closes #589.
  • Loading branch information
eregon committed Mar 1, 2018
1 parent 51f301d commit a23caca
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions language/precedence_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,14 @@ class FalseClass; undef_method :=~; end
lambda { eval("1...2...3") }.should raise_error(SyntaxError)
end

# XXX: this is commented now due to a bug in compiler, which cannot
# distinguish between range and flip-flop operator so far. zenspider is
# currently working on a new lexer, which will be able to do that.
# As soon as it's done, these piece should be reenabled.
#
# it ".. ... have higher precedence than ? :" do
# (1..2 ? 3 : 4).should == 3
# (1...2 ? 3 : 4).should == 3
# end
it ".. ... have higher precedence than ? :" do
# Use variables to avoid warnings
from = 1
to = 2
# These are Range instances, not flip-flop
(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
Expand Down

0 comments on commit a23caca

Please sign in to comment.