[macruby-changes] [1794] MacRuby/branches/experimental/spec/frozen
source_changes at macosforge.org
source_changes at macosforge.org
Sat Jun 6 20:42:19 PDT 2009
Revision: 1794
http://trac.macosforge.org/projects/ruby/changeset/1794
Author: lsansonetti at apple.com
Date: 2009-06-06 20:42:19 -0700 (Sat, 06 Jun 2009)
Log Message:
-----------
ported some of the struct specs to 1.9, tagged 3 struct specs that do not run on macruby (2 of them don't run on 1.9 either, i left a XXX comment)
Modified Paths:
--------------
MacRuby/branches/experimental/spec/frozen/core/struct/members_spec.rb
MacRuby/branches/experimental/spec/frozen/core/struct/new_spec.rb
Added Paths:
-----------
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/struct/
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/struct/initialize_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/struct/new_tags.txt
Modified: MacRuby/branches/experimental/spec/frozen/core/struct/members_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/struct/members_spec.rb 2009-06-07 03:41:14 UTC (rev 1793)
+++ MacRuby/branches/experimental/spec/frozen/core/struct/members_spec.rb 2009-06-07 03:42:19 UTC (rev 1794)
@@ -2,9 +2,19 @@
require File.dirname(__FILE__) + '/fixtures/classes'
describe "Struct#members" do
- it "returns an array of attribute names" do
- Struct::Car.new.members.should == %w(make model year)
- Struct::Car.new('Cadillac').members.should == %w(make model year)
- Struct::Ruby.members.should == %w(version platform)
- end
+ ruby_version_is "" ... "1.9" do
+ it "returns an array of attribute names" do
+ Struct::Car.new.members.should == %w(make model year)
+ Struct::Car.new('Cadillac').members.should == %w(make model year)
+ Struct::Ruby.members.should == %w(version platform)
+ end
+ end
+
+ ruby_version_is "1.9" do
+ it "returns an array of attribute names" do
+ Struct::Car.new.members.should == [:make, :model, :year]
+ Struct::Car.new('Cadillac').members.should == [:make, :model, :year]
+ Struct::Ruby.members.should == [:version, :platform]
+ end
+ end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/struct/new_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/struct/new_spec.rb 2009-06-07 03:41:14 UTC (rev 1793)
+++ MacRuby/branches/experimental/spec/frozen/core/struct/new_spec.rb 2009-06-07 03:42:19 UTC (rev 1794)
@@ -26,24 +26,45 @@
struct.name.should == "Struct::Foo"
end
- it "creates a new anonymous class with nil first argument" do
- struct = Struct.new(nil, :foo)
- struct.new("bar").foo.should == "bar"
- struct.class.should == Class
- struct.name.should == ""
+ ruby_version_is "" ... "1.9" do
+ it "creates a new anonymous class with nil first argument" do
+ struct = Struct.new(nil, :foo)
+ struct.new("bar").foo.should == "bar"
+ struct.class.should == Class
+ struct.name.should == ""
+ end
end
+ ruby_version_is "1.9" do
+ it "creates a new anonymous class with nil first argument" do
+ struct = Struct.new(nil, :foo)
+ struct.new("bar").foo.should == "bar"
+ struct.class.should == Class
+ struct.name.should == nil
+ end
+ end
+
it "does not create a constant with symbol as first argument" do
struct = Struct.new(:Animal, :name, :legs, :eyeballs)
struct.should_not == Struct::Animal
end
- it "creates a new anonymous class with symbol arguments" do
- struct = Struct.new(:make, :model)
- struct.class.should == Class
- struct.name.should == ""
+ ruby_version_is "" ... "1.9" do
+ it "creates a new anonymous class with symbol arguments" do
+ struct = Struct.new(:make, :model)
+ struct.class.should == Class
+ struct.name.should == ""
+ end
end
+ ruby_version_is "1.9" do
+ it "creates a new anonymous class with symbol arguments" do
+ struct = Struct.new(:make, :model)
+ struct.class.should == Class
+ struct.name.should == nil
+ end
+ end
+
it "fails with invalid constant name as first argument" do
lambda { Struct.new('animal', :name, :legs, :eyeballs) }.should raise_error(NameError)
end
@@ -66,6 +87,7 @@
end
not_compliant_on :rubinius do
+ # XXX these 2 specs do not work as expected on 1.9 either
it "accepts Fixnums as Symbols unless fixnum.to_sym.nil?" do
num = :foo.to_i
Struct.new(nil, num).new("bar").foo.should == "bar"
@@ -78,11 +100,20 @@
end
end
- it "instance_eval's a passed block" do
- klass = Struct.new(:something) { @something_else = 'something else entirely!' }
- klass.instance_variables.should include('@something_else')
+ ruby_version_is "" ... "1.9" do
+ it "instance_eval's a passed block" do
+ klass = Struct.new(:something) { @something_else = 'something else entirely!' }
+ klass.instance_variables.should include('@something_else')
+ end
end
+ ruby_version_is "1.9" do
+ it "instance_eval's a passed block" do
+ klass = Struct.new(:something) { @something_else = 'something else entirely!' }
+ klass.instance_variables.should include(:@something_else)
+ end
+ end
+
it "creates a constant in subclass' namespace" do
struct = Apple.new('Computer', :size)
struct.should == Apple::Computer
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/struct/initialize_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/struct/initialize_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/struct/initialize_tags.txt 2009-06-07 03:42:19 UTC (rev 1794)
@@ -0,0 +1 @@
+fails:Struct#initialize is private
Property changes on: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/struct/initialize_tags.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/struct/new_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/struct/new_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/struct/new_tags.txt 2009-06-07 03:42:19 UTC (rev 1794)
@@ -0,0 +1,2 @@
+fails:Struct.new accepts Fixnums as Symbols unless fixnum.to_sym.nil?
+fails:Struct.new raises an ArgumentError if fixnum#to_sym is nil
Property changes on: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/struct/new_tags.txt
___________________________________________________________________
Added: svn:eol-style
+ native
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090606/23b08798/attachment-0001.html>
More information about the macruby-changes
mailing list