[macruby-changes] [3922] MacRuby/trunk/spec/frozen/language
source_changes at macosforge.org
source_changes at macosforge.org
Mon Apr 12 22:26:56 PDT 2010
Revision: 3922
http://trac.macosforge.org/projects/ruby/changeset/3922
Author: lsansonetti at apple.com
Date: 2010-04-12 22:26:55 -0700 (Mon, 12 Apr 2010)
Log Message:
-----------
enable BEGIN language spec, one example is failing (will investigate that later)
Added Paths:
-----------
MacRuby/trunk/spec/frozen/language/BEGIN_spec.rb
Removed Paths:
-------------
MacRuby/trunk/spec/frozen/language/BEGIN_spec_disabled.rb
Copied: MacRuby/trunk/spec/frozen/language/BEGIN_spec.rb (from rev 3920, MacRuby/trunk/spec/frozen/language/BEGIN_spec_disabled.rb)
===================================================================
--- MacRuby/trunk/spec/frozen/language/BEGIN_spec.rb (rev 0)
+++ MacRuby/trunk/spec/frozen/language/BEGIN_spec.rb 2010-04-13 05:26:55 UTC (rev 3922)
@@ -0,0 +1,57 @@
+require File.expand_path('../../spec_helper', __FILE__)
+
+describe "The BEGIN keyword" do
+ ruby_version_is "" ... "1.9" do
+ it "runs in a new isolated scope" do
+ lambda {
+ eval "BEGIN { var_in_begin = 'foo' }; var_in_begin"
+ }.should raise_error NameError
+
+ lambda {
+ outside_var = 'foo'
+ eval "BEGIN { outside_var }"
+ }.should raise_error NameError
+ end
+ end
+
+ ruby_version_is "1.9" do
+ it "runs in a shared scope" do
+ lambda {
+ eval "BEGIN { var_in_begin = 'foo' }; var_in_begin"
+ }.should_not raise_error NameError
+
+ lambda {
+ outside_var = 'foo'
+ eval "BEGIN { outside_var }"
+ }.should_not raise_error NameError
+ end
+
+ it "must appear in a top-level context" do
+ lambda do
+ eval "1.times{ BEGIN{ :begun }}"
+ end.should raise_error(SyntaxError)
+ end
+ end
+
+ it "runs first in a given code unit" do
+ o = Object.new
+ class << o
+ ARY = []
+ eval "ARY << 'foo'; BEGIN { ARY << 'bar' }"
+ def ary; ARY; end
+ end
+
+ o.ary.should == ['bar', 'foo']
+ end
+
+ it "runs multiple begins in FIFO order" do
+ o = Object.new
+ class << o
+ ARY = []
+ eval "BEGIN { ARY << 'foo' }; BEGIN { ARY << 'bar' }"
+ def ary; ARY; end
+ end
+
+ o.ary.should == ['foo', 'bar']
+ end
+end
Deleted: MacRuby/trunk/spec/frozen/language/BEGIN_spec_disabled.rb
===================================================================
--- MacRuby/trunk/spec/frozen/language/BEGIN_spec_disabled.rb 2010-04-13 05:26:28 UTC (rev 3921)
+++ MacRuby/trunk/spec/frozen/language/BEGIN_spec_disabled.rb 2010-04-13 05:26:55 UTC (rev 3922)
@@ -1,57 +0,0 @@
-require File.expand_path('../../spec_helper', __FILE__)
-
-describe "The BEGIN keyword" do
- ruby_version_is "" .. "1.9" do
- it "runs in a new isolated scope" do
- lambda {
- eval "BEGIN { var_in_begin = 'foo' }; var_in_begin"
- }.should raise_error NameError
-
- lambda {
- outside_var = 'foo'
- eval "BEGIN { outside_var }"
- }.should raise_error NameError
- end
- end
-
- ruby_version_is "1.9" do
- it "runs in a shared scope" do
- lambda {
- eval "BEGIN { var_in_begin = 'foo' }; var_in_begin"
- }.should_not raise_error NameError
-
- lambda {
- outside_var = 'foo'
- eval "BEGIN { outside_var }"
- }.should_not raise_error NameError
- end
-
- it "must appear in a top-level context" do
- lambda do
- eval "1.times{ BEGIN{ :begun }}"
- end.should raise_error(SyntaxError)
- end
- end
-
- it "runs first in a given code unit" do
- o = Object.new
- class << o
- ARY = []
- eval "ARY << 'foo'; BEGIN { ARY << 'bar' }"
- def ary; ARY; end
- end
-
- o.ary.should == ['bar', 'foo']
- end
-
- it "runs multiple begins in FIFO order" do
- o = Object.new
- class << o
- ARY = []
- eval "BEGIN { ARY << 'foo' }; BEGIN { ARY << 'bar' }"
- def ary; ARY; end
- end
-
- o.ary.should == ['foo', 'bar']
- end
-end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100412/a4ee62d0/attachment.html>
More information about the macruby-changes
mailing list