diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-04 15:09:32 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-03-04 15:09:32 +0000 |
commit | 401b64c4e840bc8887219e9e445a64b3d5943656 (patch) | |
tree | 989b93914e9a8ee57ef3ce0bb3d2e2083470fc49 /spec/ruby/language/precedence_spec.rb | |
parent | 8a15857a7f283101a3923b76c71a1f05bfe58512 (diff) |
Update to ruby/spec@c1b568b
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/language/precedence_spec.rb')
-rw-r--r-- | spec/ruby/language/precedence_spec.rb | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/spec/ruby/language/precedence_spec.rb b/spec/ruby/language/precedence_spec.rb index 90734022ff..2dcb9975bc 100644 --- a/spec/ruby/language/precedence_spec.rb +++ b/spec/ruby/language/precedence_spec.rb @@ -1,5 +1,5 @@ -require File.expand_path('../../spec_helper', __FILE__) -require File.expand_path('../fixtures/precedence', __FILE__) +require_relative '../spec_helper' +require_relative 'fixtures/precedence' # Specifying the behavior of operators in combination could # lead to combinatorial explosion. A better way seems to be @@ -296,15 +296,14 @@ describe "Operators" do 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 |