[macruby-changes] [1206] MacRuby/branches/experimental/spec/frozen/language/variables_spec.rb
source_changes at macosforge.org
source_changes at macosforge.org
Fri Mar 27 11:49:20 PDT 2009
Revision: 1206
http://trac.macosforge.org/projects/ruby/changeset/1206
Author: lsansonetti at apple.com
Date: 2009-03-27 11:49:20 -0700 (Fri, 27 Mar 2009)
Log Message:
-----------
rewrote a few specs to work with ruby 1.9 (note, still 4 failures)
Modified Paths:
--------------
MacRuby/branches/experimental/spec/frozen/language/variables_spec.rb
Modified: MacRuby/branches/experimental/spec/frozen/language/variables_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/language/variables_spec.rb 2009-03-27 08:36:32 UTC (rev 1205)
+++ MacRuby/branches/experimental/spec/frozen/language/variables_spec.rb 2009-03-27 18:49:20 UTC (rev 1206)
@@ -20,50 +20,109 @@
it "assigns nil to lhs when rhs is an empty expression" do
a = ()
a.should be_nil
+ end
- a = *()
- a.should be_nil
+ ruby_version_is "" ... "1.9" do
+ it "assigns nil to lhs when rhs is an empty splat expression" do
+ a = *()
+ a.should be_nil
+ end
end
+ ruby_version_is "1.9" do
+ it "assigns [] to lhs when rhs is an empty splat expression" do
+ a = *()
+ a.should == []
+ end
+ end
- it "allows the assignment of the rhs to the lhs using the rhs splat operator" do
- a = *nil; a.should == nil
- a = *1; a.should == 1
- a = *[]; a.should == nil
- a = *[1]; a.should == 1
- a = *[nil]; a.should == nil
- a = *[[]]; a.should == []
- a = *[1,2]; a.should == [1,2]
- a = *[*[]]; a.should == nil
- a = *[*[1]]; a.should == 1
- a = *[*[1,2]]; a.should == [1,2]
+ ruby_version_is "" ... "1.9" do
+ it "allows the assignment of the rhs to the lhs using the rhs splat operator" do
+ a = *nil; a.should == nil
+ a = *1; a.should == 1
+ a = *[]; a.should == nil
+ a = *[1]; a.should == 1
+ a = *[nil]; a.should == nil
+ a = *[[]]; a.should == []
+ a = *[1,2]; a.should == [1,2]
+ a = *[*[]]; a.should == nil
+ a = *[*[1]]; a.should == 1
+ a = *[*[1,2]]; a.should == [1,2]
+ end
end
+ ruby_version_is "1.9" do
+ it "allows the assignment of the rhs to the lhs using the rhs splat operator" do
+ a = *nil; a.should == []
+ a = *1; a.should == [1]
+ a = *[]; a.should == []
+ a = *[1]; a.should == [1]
+ a = *[nil]; a.should == [nil]
+ a = *[[]]; a.should == [[]]
+ a = *[1,2]; a.should == [1,2]
+ a = *[*[]]; a.should == []
+ a = *[*[1]]; a.should == [1]
+ a = *[*[1,2]]; a.should == [1,2]
+ end
+ end
- it "allows the assignment of the rhs to the lhs using the lhs splat operator" do
- * = 1,2 # Valid syntax, but pretty useless! Nothing to test
- *a = nil; a.should == [nil]
- *a = 1; a.should == [1]
- *a = []; a.should == [[]]
- *a = [1]; a.should == [[1]]
- *a = [nil]; a.should == [[nil]]
- *a = [[]]; a.should == [[[]]]
- *a = [1,2]; a.should == [[1,2]]
- *a = [*[]]; a.should == [[]]
- *a = [*[1]]; a.should == [[1]]
- *a = [*[1,2]]; a.should == [[1,2]]
+ ruby_version_is "" ... "1.9" do
+ it "allows the assignment of the rhs to the lhs using the lhs splat operator" do
+ * = 1,2 # Valid syntax, but pretty useless! Nothing to test
+ *a = nil; a.should == [nil]
+ *a = 1; a.should == [1]
+ *a = []; a.should == [[]]
+ *a = [1]; a.should == [[1]]
+ *a = [nil]; a.should == [[nil]]
+ *a = [[]]; a.should == [[[]]]
+ *a = [1,2]; a.should == [[1,2]]
+ *a = [*[]]; a.should == [[]]
+ *a = [*[1]]; a.should == [[1]]
+ *a = [*[1,2]]; a.should == [[1,2]]
+ end
end
+ ruby_version_is "1.9" do
+ it "allows the assignment of the rhs to the lhs using the lhs splat operator" do
+ * = 1,2 # Valid syntax, but pretty useless! Nothing to test
+ *a = nil; a.should == [nil]
+ *a = 1; a.should == [1]
+ *a = []; a.should == []
+ *a = [1]; a.should == [1]
+ *a = [nil]; a.should == [nil]
+ *a = [[]]; a.should == [[]]
+ *a = [1,2]; a.should == [1,2]
+ *a = [*[]]; a.should == []
+ *a = [*[1]]; a.should == [1]
+ *a = [*[1,2]]; a.should == [1,2]
+ end
+ end
- it "allows the assignment of rhs to the lhs using the lhs and rhs splat operators simultaneously" do
- *a = *nil; a.should == [nil]
- *a = *1; a.should == [1]
- *a = *[]; a.should == []
- *a = *[1]; a.should == [1]
- *a = *[nil]; a.should == [nil]
- *a = *[[]]; a.should == [[]]
- *a = *[1,2]; a.should == [1,2]
- *a = *[*[]]; a.should == []
- *a = *[*[1]]; a.should == [1]
- *a = *[*[1,2]]; a.should == [1,2]
+ ruby_version_is "" ... "1.9" do
+ it "allows the assignment of rhs to the lhs using the lhs and rhs splat operators simultaneously" do
+ *a = *nil; a.should == [nil]
+ *a = *1; a.should == [1]
+ *a = *[]; a.should == []
+ *a = *[1]; a.should == [1]
+ *a = *[nil]; a.should == [nil]
+ *a = *[[]]; a.should == [[]]
+ *a = *[1,2]; a.should == [1,2]
+ *a = *[*[]]; a.should == []
+ *a = *[*[1]]; a.should == [1]
+ *a = *[*[1,2]]; a.should == [1,2]
+ end
end
+ ruby_version_is "1.9" do
+ it "allows the assignment of rhs to the lhs using the lhs and rhs splat operators simultaneously" do
+ *a = *nil; a.should == []
+ *a = *1; a.should == [1]
+ *a = *[]; a.should == []
+ *a = *[1]; a.should == [1]
+ *a = *[nil]; a.should == [nil]
+ *a = *[[]]; a.should == [[]]
+ *a = *[1,2]; a.should == [1,2]
+ *a = *[*[]]; a.should == []
+ *a = *[*[1]]; a.should == [1]
+ *a = *[*[1,2]]; a.should == [1,2]
+ end
+ end
it "allows multiple values to be assigned" do
a,b,*c = nil; [a,b,c].should == [nil, nil, []]
@@ -128,10 +187,18 @@
end
describe "Assignment using expansion" do
- it "succeeds without conversion" do
- *x = (1..7).to_a
- x.should == [[1, 2, 3, 4, 5, 6, 7]]
+ ruby_version_is "" ... "1.9" do
+ it "succeeds without conversion" do
+ *x = (1..7).to_a
+ x.should == [[1, 2, 3, 4, 5, 6, 7]]
+ end
end
+ ruby_version_is "1.9" do
+ it "succeeds without conversion" do
+ *x = (1..7).to_a
+ x.should == [1, 2, 3, 4, 5, 6, 7]
+ end
+ end
end
describe "Assigning multiple values" do
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090327/87cf9d9b/attachment-0001.html>
More information about the macruby-changes
mailing list