Revision: 1097 http://trac.macosforge.org/projects/ruby/changeset/1097 Author: eloy.de.enige@gmail.com Date: 2009-03-23 05:51:15 -0700 (Mon, 23 Mar 2009) Log Message: ----------- Moved a 1.8 specific unless example into a language version file and added a 1.9 example. Modified Paths: -------------- MacRuby/branches/experimental/spec/frozen/language/unless_spec.rb Added Paths: ----------- MacRuby/branches/experimental/spec/frozen/language/versions/unless_1.8.rb MacRuby/branches/experimental/spec/frozen/language/versions/unless_1.9.rb Modified: MacRuby/branches/experimental/spec/frozen/language/unless_spec.rb =================================================================== --- MacRuby/branches/experimental/spec/frozen/language/unless_spec.rb 2009-03-23 12:10:09 UTC (rev 1096) +++ MacRuby/branches/experimental/spec/frozen/language/unless_spec.rb 2009-03-23 12:51:15 UTC (rev 1097) @@ -36,12 +36,10 @@ it "does not return a value when the expression is true" do unless true; end.should == nil end - - it "allows expression and body to be on one line (using ':')" do - unless false: 'foo'; else 'bar'; end.should == 'foo' - end it "allows expression and body to be on one line (using 'then')" do unless false then 'foo'; else 'bar'; end.should == 'foo' end -end \ No newline at end of file +end + +language_version __FILE__, "unless" \ No newline at end of file Added: MacRuby/branches/experimental/spec/frozen/language/versions/unless_1.8.rb =================================================================== --- MacRuby/branches/experimental/spec/frozen/language/versions/unless_1.8.rb (rev 0) +++ MacRuby/branches/experimental/spec/frozen/language/versions/unless_1.8.rb 2009-03-23 12:51:15 UTC (rev 1097) @@ -0,0 +1,5 @@ +describe "The unless expression" do + it "allows expression and body to be on one line (using ':')" do + unless false: 'foo'; else 'bar'; end.should == 'foo' + end +end \ No newline at end of file Added: MacRuby/branches/experimental/spec/frozen/language/versions/unless_1.9.rb =================================================================== --- MacRuby/branches/experimental/spec/frozen/language/versions/unless_1.9.rb (rev 0) +++ MacRuby/branches/experimental/spec/frozen/language/versions/unless_1.9.rb 2009-03-23 12:51:15 UTC (rev 1097) @@ -0,0 +1,5 @@ +describe "The unless expression" do + it "raises a SyntaxError when expression and body are on one line (using ':')" do + lambda { instance_eval "unless false: 'foo'; end" }.should raise_error(SyntaxError) + end +end \ No newline at end of file