[macruby-changes] [1653] MacRuby/branches/experimental

source_changes at macosforge.org source_changes at macosforge.org
Sat May 30 14:03:26 PDT 2009


Revision: 1653
          http://trac.macosforge.org/projects/ruby/changeset/1653
Author:   eloy.de.enige at gmail.com
Date:     2009-05-30 14:03:25 -0700 (Sat, 30 May 2009)
Log Message:
-----------
Updated mspec to f27da63e165e286e8e717af15b9ed0cb809a3979 and started on a simple rake task to automatically tag since mspec-tag is still borked.

Modified Paths:
--------------
    MacRuby/branches/experimental/mspec/lib/mspec/commands/mspec-ci.rb
    MacRuby/branches/experimental/mspec/lib/mspec/commands/mspec-run.rb
    MacRuby/branches/experimental/mspec/lib/mspec/commands/mspec-tag.rb
    MacRuby/branches/experimental/mspec/lib/mspec/helpers/io.rb
    MacRuby/branches/experimental/mspec/lib/mspec/helpers.rb
    MacRuby/branches/experimental/mspec/lib/mspec/matchers.rb
    MacRuby/branches/experimental/mspec/lib/mspec/mocks/mock.rb
    MacRuby/branches/experimental/mspec/lib/mspec/mocks/proxy.rb
    MacRuby/branches/experimental/mspec/lib/mspec/runner/exception.rb
    MacRuby/branches/experimental/mspec/lib/mspec/runner.rb
    MacRuby/branches/experimental/mspec/lib/mspec/utils/options.rb
    MacRuby/branches/experimental/mspec/spec/commands/mspec_ci_spec.rb
    MacRuby/branches/experimental/mspec/spec/commands/mspec_run_spec.rb
    MacRuby/branches/experimental/mspec/spec/commands/mspec_tag_spec.rb
    MacRuby/branches/experimental/mspec/spec/expectations/should.rb
    MacRuby/branches/experimental/mspec/spec/helpers/io_spec.rb
    MacRuby/branches/experimental/mspec/spec/runner/exception_spec.rb
    MacRuby/branches/experimental/mspec/spec/utils/options_spec.rb
    MacRuby/branches/experimental/mspec/upstream
    MacRuby/branches/experimental/rakelib/spec.rake

Added Paths:
-----------
    MacRuby/branches/experimental/mspec/lib/mspec/helpers/enumerator_class.rb
    MacRuby/branches/experimental/mspec/lib/mspec/helpers/hash.rb
    MacRuby/branches/experimental/mspec/lib/mspec/matchers/have_protected_instance_method.rb
    MacRuby/branches/experimental/mspec/spec/helpers/enumerator_class_spec.rb
    MacRuby/branches/experimental/mspec/spec/helpers/hash_spec.rb
    MacRuby/branches/experimental/mspec/spec/matchers/have_protected_instance_method_spec.rb

Modified: MacRuby/branches/experimental/mspec/lib/mspec/commands/mspec-ci.rb
===================================================================
--- MacRuby/branches/experimental/mspec/lib/mspec/commands/mspec-ci.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/lib/mspec/commands/mspec-ci.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -42,6 +42,7 @@
     options.action_filters
 
     options.doc "\n Help!"
+    options.debug
     options.version MSpec::VERSION
     options.help
 

Modified: MacRuby/branches/experimental/mspec/lib/mspec/commands/mspec-run.rb
===================================================================
--- MacRuby/branches/experimental/mspec/lib/mspec/commands/mspec-run.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/lib/mspec/commands/mspec-run.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -53,6 +53,7 @@
     options.action_filters
 
     options.doc "\n Help!"
+    options.debug
     options.version MSpec::VERSION
     options.help
 

Modified: MacRuby/branches/experimental/mspec/lib/mspec/commands/mspec-tag.rb
===================================================================
--- MacRuby/branches/experimental/mspec/lib/mspec/commands/mspec-tag.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/lib/mspec/commands/mspec-tag.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -72,6 +72,7 @@
     end
 
     options.doc "\n Help!"
+    options.debug
     options.version MSpec::VERSION
     options.help
 

Added: MacRuby/branches/experimental/mspec/lib/mspec/helpers/enumerator_class.rb
===================================================================
--- MacRuby/branches/experimental/mspec/lib/mspec/helpers/enumerator_class.rb	                        (rev 0)
+++ MacRuby/branches/experimental/mspec/lib/mspec/helpers/enumerator_class.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -0,0 +1,9 @@
+class Object
+
+  # Returns the Enumerator class (either Enumerator or Enumerable::Enumerator)
+  # depending of the version.
+  #
+  def enumerator_class
+    SpecVersion.new(RUBY_VERSION) < "1.9" ? Enumerable::Enumerator : Enumerator
+  end
+end

Added: MacRuby/branches/experimental/mspec/lib/mspec/helpers/hash.rb
===================================================================
--- MacRuby/branches/experimental/mspec/lib/mspec/helpers/hash.rb	                        (rev 0)
+++ MacRuby/branches/experimental/mspec/lib/mspec/helpers/hash.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -0,0 +1,27 @@
+class Object
+  # The following helpers provide a level of indirection for running the specs
+  # against a Hash implementation that has a different name than Hash.
+
+  # Returns the Hash class.
+  unless method_defined?(:hash_class)
+    def hash_class
+      Hash
+    end
+  end
+
+  # Returns a new instance of hash_class.
+  def new_hash(*args, &block)
+    if block
+      hash_class.new(&block)
+    elsif args.size == 1
+      value = args.first
+      if value.is_a?(Hash) or value.is_a?(hash_class)
+        hash_class[value]
+      else
+        hash_class.new value
+      end
+    else
+      hash_class[*args]
+    end
+  end
+end

Modified: MacRuby/branches/experimental/mspec/lib/mspec/helpers/io.rb
===================================================================
--- MacRuby/branches/experimental/mspec/lib/mspec/helpers/io.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/lib/mspec/helpers/io.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -11,6 +11,10 @@
     write(str.collect { |s| s.to_s.chomp }.concat([nil]).join("\n"))
   end
 
+  def printf(format, *args)
+    self << sprintf(format, *args)
+  end
+
   def flush
     self
   end

Modified: MacRuby/branches/experimental/mspec/lib/mspec/helpers.rb
===================================================================
--- MacRuby/branches/experimental/mspec/lib/mspec/helpers.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/lib/mspec/helpers.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -1,9 +1,11 @@
 require 'mspec/helpers/argv'
 require 'mspec/helpers/bignum'
 require 'mspec/helpers/const_lookup'
+require 'mspec/helpers/enumerator_class'
 require 'mspec/helpers/environment'
 require 'mspec/helpers/fixture'
 require 'mspec/helpers/flunk'
+require 'mspec/helpers/hash'
 require 'mspec/helpers/io'
 require 'mspec/helpers/language_version'
 require 'mspec/helpers/ruby_exe'

Added: MacRuby/branches/experimental/mspec/lib/mspec/matchers/have_protected_instance_method.rb
===================================================================
--- MacRuby/branches/experimental/mspec/lib/mspec/matchers/have_protected_instance_method.rb	                        (rev 0)
+++ MacRuby/branches/experimental/mspec/lib/mspec/matchers/have_protected_instance_method.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -0,0 +1,24 @@
+require 'mspec/matchers/method'
+
+class HaveProtectedInstanceMethodMatcher < MethodMatcher
+  def matches?(mod)
+    @mod = mod
+    mod.protected_instance_methods(@include_super).include? @method
+  end
+
+  def failure_message
+    ["Expected #{@mod} to have protected instance method '#{@method.to_s}'",
+     "but it does not"]
+  end
+
+  def negative_failure_message
+    ["Expected #{@mod} NOT to have protected instance method '#{@method.to_s}'",
+     "but it does"]
+  end
+end
+
+class Object
+  def have_protected_instance_method(method, include_super=true)
+    HaveProtectedInstanceMethodMatcher.new method, include_super
+  end
+end

Modified: MacRuby/branches/experimental/mspec/lib/mspec/matchers.rb
===================================================================
--- MacRuby/branches/experimental/mspec/lib/mspec/matchers.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/lib/mspec/matchers.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -1,4 +1,5 @@
 require 'mspec/matchers/base'
+require 'mspec/matchers/be_an_instance_of'
 require 'mspec/matchers/be_ancestor_of'
 require 'mspec/matchers/be_close'
 require 'mspec/matchers/be_empty'

Modified: MacRuby/branches/experimental/mspec/lib/mspec/mocks/mock.rb
===================================================================
--- MacRuby/branches/experimental/mspec/lib/mspec/mocks/mock.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/lib/mspec/mocks/mock.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -88,7 +88,7 @@
 
   def self.verify_call(obj, sym, *args, &block)
     compare = *args
-    if RUBY_VERSION >= '1.9'
+    if (behaves_like_ruby_1_9 = *[])
       compare = compare.first if compare.length <= 1
     end
 

Modified: MacRuby/branches/experimental/mspec/lib/mspec/mocks/proxy.rb
===================================================================
--- MacRuby/branches/experimental/mspec/lib/mspec/mocks/proxy.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/lib/mspec/mocks/proxy.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -88,7 +88,7 @@
   def with(*args)
     raise ArgumentError, "you must specify the expected arguments" if args.empty?
     @arguments = *args
-    if RUBY_VERSION >= '1.9'
+    if (behaves_like_ruby_1_9 = *[])
       @arguments = @arguments.first if @arguments.length <= 1
     end
     self

Modified: MacRuby/branches/experimental/mspec/lib/mspec/runner/exception.rb
===================================================================
--- MacRuby/branches/experimental/mspec/lib/mspec/runner/exception.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/lib/mspec/runner/exception.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -1,8 +1,6 @@
 class ExceptionState
   attr_reader :description, :describe, :it, :exception
 
-  PATH = /#{File.expand_path(File.dirname(__FILE__) + '/../../..')}/
-
   def initialize(state, location, exception)
     @exception = exception
 
@@ -33,11 +31,14 @@
   end
 
   def backtrace
+    @backtrace_filter ||= MSpecScript.config[:backtrace_filter]
+
     begin
       bt = @exception.awesome_backtrace.show.split "\n"
     rescue Exception
       bt = @exception.backtrace || []
     end
-    bt.reject { |line| PATH =~ line }.join("\n")
+
+    bt.select { |line| $MSPEC_DEBUG or @backtrace_filter !~ line }.join("\n")
   end
 end

Modified: MacRuby/branches/experimental/mspec/lib/mspec/runner.rb
===================================================================
--- MacRuby/branches/experimental/mspec/lib/mspec/runner.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/lib/mspec/runner.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -2,6 +2,7 @@
 require 'mspec/runner/mspec'
 require 'mspec/runner/context'
 require 'mspec/runner/example'
+require 'mspec/runner/exception'
 require 'mspec/runner/object'
 require 'mspec/runner/formatters'
 require 'mspec/runner/actions'

Modified: MacRuby/branches/experimental/mspec/lib/mspec/utils/options.rb
===================================================================
--- MacRuby/branches/experimental/mspec/lib/mspec/utils/options.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/lib/mspec/utils/options.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -440,4 +440,11 @@
       config[:gdb] = true
     end
   end
+
+  def debug
+    on("-d", "--debug",
+       "Set MSpec debugging flag for more verbose output") do
+      $MSPEC_DEBUG = true
+    end
+  end
 end

Modified: MacRuby/branches/experimental/mspec/spec/commands/mspec_ci_spec.rb
===================================================================
--- MacRuby/branches/experimental/mspec/spec/commands/mspec_ci_spec.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/spec/commands/mspec_ci_spec.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -88,6 +88,11 @@
     @script.options
   end
 
+  it "enables the debug option" do
+    @options.should_receive(:debug)
+    @script.options @argv
+  end
+
   it "calls #custom_options" do
     @script.should_receive(:custom_options).with(@options)
     @script.options

Modified: MacRuby/branches/experimental/mspec/spec/commands/mspec_run_spec.rb
===================================================================
--- MacRuby/branches/experimental/mspec/spec/commands/mspec_run_spec.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/spec/commands/mspec_run_spec.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -118,6 +118,11 @@
     @script.options @argv
   end
 
+  it "enables the debug option" do
+    @options.should_receive(:debug)
+    @script.options @argv
+  end
+
   it "exits if there are no files to process" do
     @options.should_receive(:parse).and_return([])
     @script.should_receive(:exit)

Modified: MacRuby/branches/experimental/mspec/spec/commands/mspec_tag_spec.rb
===================================================================
--- MacRuby/branches/experimental/mspec/spec/commands/mspec_tag_spec.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/spec/commands/mspec_tag_spec.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -98,6 +98,11 @@
     @script.options @argv
   end
 
+  it "enables the debug option" do
+    @options.should_receive(:debug)
+    @script.options @argv
+  end
+
   it "calls #custom_options" do
     @script.should_receive(:custom_options).with(@options)
     @script.options @argv

Modified: MacRuby/branches/experimental/mspec/spec/expectations/should.rb
===================================================================
--- MacRuby/branches/experimental/mspec/spec/expectations/should.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/spec/expectations/should.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -1,5 +1,6 @@
 $: << File.dirname(__FILE__) + '/../../lib'
 require 'mspec'
+require 'mspec/utils/script'
 
 # The purpose of these specs is to confirm that the #should
 # and #should_not methods are functioning appropriately. We

Added: MacRuby/branches/experimental/mspec/spec/helpers/enumerator_class_spec.rb
===================================================================
--- MacRuby/branches/experimental/mspec/spec/helpers/enumerator_class_spec.rb	                        (rev 0)
+++ MacRuby/branches/experimental/mspec/spec/helpers/enumerator_class_spec.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -0,0 +1,19 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+require 'mspec/helpers/enumerator_class'
+
+describe "#enumerator_class" do
+
+  ruby_version_is ''...'1.8.7' do
+    it "returns Enumerable::Enumerator in Ruby 1.8.6-" do
+      lambda { enumerator_class }.should raise_error(NameError)
+      require 'enumerator'
+      enumerator_class.should == Enumerable::Enumerator
+    end
+  end
+
+  ruby_version_is '1.8.7' do
+    it "returns Enumerator in Ruby 1.8.7+" do
+      enumerator_class.should == Enumerator
+    end
+  end
+end

Added: MacRuby/branches/experimental/mspec/spec/helpers/hash_spec.rb
===================================================================
--- MacRuby/branches/experimental/mspec/spec/helpers/hash_spec.rb	                        (rev 0)
+++ MacRuby/branches/experimental/mspec/spec/helpers/hash_spec.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -0,0 +1,30 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+require 'mspec/helpers/hash'
+
+describe Object, "#hash_class" do
+  it "returns the Hash class" do
+    hash_class.should == Hash
+  end
+end
+
+describe Object, "#new_hash" do
+  it "returns a default hash" do
+    new_hash.should == {}
+  end
+
+  it "returns a hash having a default value" do
+    hash = new_hash(5)
+    hash[:none].should == 5
+  end
+
+  it "returns a hash having a default proc" do
+    hash = new_hash { |h, k| h[k] = :default }
+    hash[:none].should == :default
+  end
+
+  it "returns a hash constructed from keys and values" do
+    new_hash({:a => 1, :b => 2}).should == { :a => 1, :b => 2 }
+    new_hash(1 => 2, 3 => 4).should == { 1 => 2, 3 => 4 }
+    new_hash(1, 2, 3, 4).should == { 1 => 2, 3 => 4 }
+  end
+end

Modified: MacRuby/branches/experimental/mspec/spec/helpers/io_spec.rb
===================================================================
--- MacRuby/branches/experimental/mspec/spec/helpers/io_spec.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/spec/helpers/io_spec.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -32,6 +32,11 @@
     @out.should == "hello\n1\n2\n3\n"
   end
 
+  it "provides a printf method" do
+    @out.printf "%-10s, %03d, %2.1f", "test", 42, 4.2
+    @out.should == "test      , 042, 4.2"
+  end
+
   it "provides a flush method that does nothing and returns self" do
     @out.flush.should == @out
   end

Added: MacRuby/branches/experimental/mspec/spec/matchers/have_protected_instance_method_spec.rb
===================================================================
--- MacRuby/branches/experimental/mspec/spec/matchers/have_protected_instance_method_spec.rb	                        (rev 0)
+++ MacRuby/branches/experimental/mspec/spec/matchers/have_protected_instance_method_spec.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -0,0 +1,57 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+require 'mspec/expectations/expectations'
+require 'mspec/matchers/have_protected_instance_method'
+
+class HPIMMSpecs
+  protected
+
+  def protected_method
+  end
+
+  class Subclass < HPIMMSpecs
+    protected
+
+    def protected_sub_method
+    end
+  end
+end
+
+describe HaveProtectedInstanceMethodMatcher do
+  it "inherits from MethodMatcher" do
+    HaveProtectedInstanceMethodMatcher.new(:m).should be_kind_of(MethodMatcher)
+  end
+
+  it "matches when mod has the protected instance method" do
+    matcher = HaveProtectedInstanceMethodMatcher.new :protected_method
+    matcher.matches?(HPIMMSpecs).should be_true
+    matcher.matches?(HPIMMSpecs::Subclass).should be_true
+  end
+
+  it "does not match when mod does not have the protected instance method" do
+    matcher = HaveProtectedInstanceMethodMatcher.new :another_method
+    matcher.matches?(HPIMMSpecs).should be_false
+  end
+
+  it "does not match if the method is in a superclass and include_super is false" do
+    matcher = HaveProtectedInstanceMethodMatcher.new :protected_method, false
+    matcher.matches?(HPIMMSpecs::Subclass).should be_false
+  end
+
+  it "provides a failure message for #should" do
+    matcher = HaveProtectedInstanceMethodMatcher.new :some_method
+    matcher.matches?(HPIMMSpecs)
+    matcher.failure_message.should == [
+      "Expected HPIMMSpecs to have protected instance method 'some_method'",
+      "but it does not"
+    ]
+  end
+
+  it "provides a failure messoge for #should_not" do
+    matcher = HaveProtectedInstanceMethodMatcher.new :some_method
+    matcher.matches?(HPIMMSpecs)
+    matcher.negative_failure_message.should == [
+      "Expected HPIMMSpecs NOT to have protected instance method 'some_method'",
+      "but it does"
+    ]
+  end
+end

Modified: MacRuby/branches/experimental/mspec/spec/runner/exception_spec.rb
===================================================================
--- MacRuby/branches/experimental/mspec/spec/runner/exception_spec.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/spec/runner/exception_spec.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -2,6 +2,7 @@
 require 'mspec/expectations/expectations'
 require 'mspec/runner/example'
 require 'mspec/runner/exception'
+require 'mspec/utils/script'
 
 describe ExceptionState, "#initialize" do
   it "takes a state, location (e.g. before :each), and exception" do
@@ -110,25 +111,31 @@
 
 describe ExceptionState, "#backtrace" do
   before :each do
-    @action = mock("action")
-    def @action.exception(exc)
-      ScratchPad.record exc.exception
+    begin
+      raise Exception
+    rescue Exception => @exception
+      @exc = ExceptionState.new @state, "", @exception
     end
-    MSpec.register :exception, @action
+  end
 
-    ScratchPad.clear
-    MSpec.protect("") { raise Exception }
-
-    @exc = ExceptionState.new @state, "", ScratchPad.recorded
+  after :each do
+    $MSPEC_DEBUG = nil
   end
 
   it "returns a string representation of the exception backtrace" do
     @exc.backtrace.should be_kind_of(String)
   end
 
-  it "strips MSpec files from the backtrace" do
+  it "does not filter files from the backtrace if $MSPEC_DEBUG is true" do
+    $MSPEC_DEBUG = true
+    @exc.backtrace.should == @exception.backtrace.join("\n")
+  end
+
+  it "filters files matching config[:backtrace_filter]" do
+    MSpecScript.set :backtrace_filter, %r[mspec/lib]
+    $MSPEC_DEBUG = nil
     @exc.backtrace.split("\n").each do |line|
-      line.should_not =~ ExceptionState::PATH
+      line.should_not =~ %r[mspec/lib]
     end
   end
 end

Modified: MacRuby/branches/experimental/mspec/spec/utils/options_spec.rb
===================================================================
--- MacRuby/branches/experimental/mspec/spec/utils/options_spec.rb	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/spec/utils/options_spec.rb	2009-05-30 21:03:25 UTC (rev 1653)
@@ -1290,3 +1290,29 @@
     @config[:gdb].should == true
   end
 end
+
+describe "The -d, --debug option" do
+  before :each do
+    @options, @config = new_option
+    @options.debug
+  end
+
+  after :each do
+    $MSPEC_DEBUG = nil
+  end
+
+  it "is enabled with #debug" do
+    @options.stub!(:on)
+    @options.should_receive(:on).with("-d", "--debug", an_instance_of(String))
+    @options.debug
+  end
+
+  it "sets $MSPEC_DEBUG to true" do
+    ["-d", "--debug"].each do |opt|
+      $MSPEC_DEBUG.should_not be_true
+      @options.parse opt
+      $MSPEC_DEBUG.should be_true
+      $MSPEC_DEBUG = nil
+    end
+  end
+end

Modified: MacRuby/branches/experimental/mspec/upstream
===================================================================
--- MacRuby/branches/experimental/mspec/upstream	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/mspec/upstream	2009-05-30 21:03:25 UTC (rev 1653)
@@ -1 +1 @@
-27d729bf91ed366ca32af6cd3eb35e69e6bf3855
\ No newline at end of file
+f27da63e165e286e8e717af15b9ed0cb809a3979
\ No newline at end of file

Modified: MacRuby/branches/experimental/rakelib/spec.rake
===================================================================
--- MacRuby/branches/experimental/rakelib/spec.rake	2009-05-30 20:37:40 UTC (rev 1652)
+++ MacRuby/branches/experimental/rakelib/spec.rake	2009-05-30 21:03:25 UTC (rev 1653)
@@ -103,6 +103,32 @@
     sh "./mspec/bin/mspec run -V -f s -g fails -B #{MACRUBY_MSPEC} #{CI_DIRS}"
   end
   
+  task :tag_failing do
+    klass = ENV['class']
+    puts "Tagging failing examples of class `#{klass}'"
+    
+    Dir.glob("./spec/frozen/core/#{klass}/*_spec.rb").each do |spec_file|
+      cmd = "./mspec/bin/mspec ci -f s -B ./spec/macruby.mspec #{spec_file}"
+      out = `#{cmd}`
+      
+      tag_base = "./spec/frozen/tags/macruby/core/#{klass}"
+      mkdir_p tag_base
+      
+      if out.match(/^1\)(.+?)(FAILED|ERROR)/m)
+        failures = $1.strip.split("\n")
+        
+        tag_file = "#{tag_base}/#{spec_file.match(/\/(\w+)_spec\.rb$/)[1]}_tags.txt"
+        puts "Writing tags file: #{tag_file}"
+        
+        File.open(tag_file, 'a+') do |f|
+          failures.each do |failure|
+            f << "fails:#{failure}\n"
+          end
+        end
+      end
+    end
+  end
+  
   %w{ fails critical }.each do |tag|
     namespace :list do
       # We cheat by using the fact that currently the ruby.1.9.mspec script uses the macruby tags,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090530/41be364f/attachment-0001.html>


More information about the macruby-changes mailing list