Revision: 1198 http://trac.macosforge.org/projects/ruby/changeset/1198 Author: lsansonetti@apple.com Date: 2009-03-26 21:22:01 -0700 (Thu, 26 Mar 2009) Log Message: ----------- marked 1.8-only specs as such Modified Paths: -------------- MacRuby/branches/experimental/spec/frozen/language/precedence_spec.rb Modified: MacRuby/branches/experimental/spec/frozen/language/precedence_spec.rb =================================================================== --- MacRuby/branches/experimental/spec/frozen/language/precedence_spec.rb 2009-03-27 04:21:39 UTC (rev 1197) +++ MacRuby/branches/experimental/spec/frozen/language/precedence_spec.rb 2009-03-27 04:22:01 UTC (rev 1198) @@ -101,16 +101,18 @@ (++2).should == 2 end - it "! ~ + have a higher precedence than **" do - class FalseClass; def **(a); 1000; end; end - (!0**2).should == 1000 - class FalseClass; undef_method :**; end + ruby_version_is "" ... "1.9" do + it "! ~ + have a higher precedence than **" do + class FalseClass; def **(a); 1000; end; end + (!0**2).should == 1000 + class FalseClass; undef_method :**; end - class UnaryPlusTest; def +@; 50; end; end - a = UnaryPlusTest.new - (+a**2).should == 2500 + class UnaryPlusTest; def +@; 50; end; end + a = UnaryPlusTest.new + (+a**2).should == 2500 - (~0**2).should == 1 + (~0**2).should == 1 + end end it "** is right-associative" do @@ -250,36 +252,38 @@ (e > 0 > 1).should_not == e > (0 > 1) end - it "<= < > >= have higher precedence than <=> == === != =~ !~" do - (1 <=> 5 < 1).should == nil - (1 <=> 5 <= 1).should == nil - (1 <=> 5 > 1).should == nil - (1 <=> 5 >= 1).should == nil - - (1 == 5 < 1).should == false - (1 == 5 <= 1).should == false - (1 == 5 > 1).should == false - (1 == 5 >= 1).should == false - - (1 === 5 < 1).should == false - (1 === 5 <= 1).should == false - (1 === 5 > 1).should == false - (1 === 5 >= 1).should == false - - (1 != 5 < 1).should == true - (1 != 5 <= 1).should == true - (1 != 5 > 1).should == true - (1 != 5 >= 1).should == true - - (1 =~ 5 < 1).should == false - (1 =~ 5 <= 1).should == false - (1 =~ 5 > 1).should == false - (1 =~ 5 >= 1).should == false - - (1 !~ 5 < 1).should == true - (1 !~ 5 <= 1).should == true - (1 !~ 5 > 1).should == true - (1 !~ 5 >= 1).should == true + ruby_version_is "" ... "1.9" do + it "<= < > >= have higher precedence than <=> == === != =~ !~" do + (1 <=> 5 < 1).should == nil + (1 <=> 5 <= 1).should == nil + (1 <=> 5 > 1).should == nil + (1 <=> 5 >= 1).should == nil + + (1 == 5 < 1).should == false + (1 == 5 <= 1).should == false + (1 == 5 > 1).should == false + (1 == 5 >= 1).should == false + + (1 === 5 < 1).should == false + (1 === 5 <= 1).should == false + (1 === 5 > 1).should == false + (1 === 5 >= 1).should == false + + (1 != 5 < 1).should == true + (1 != 5 <= 1).should == true + (1 != 5 > 1).should == true + (1 != 5 >= 1).should == true + + (1 =~ 5 < 1).should == false + (1 =~ 5 <= 1).should == false + (1 =~ 5 > 1).should == false + (1 =~ 5 >= 1).should == false + + (1 !~ 5 < 1).should == true + (1 !~ 5 <= 1).should == true + (1 !~ 5 > 1).should == true + (1 !~ 5 >= 1).should == true + end end it "<=> == === != =~ !~ are non-associative" do