[#8136] Confused exception handling in Continuation Context — "Robert Dober" <robert.dober@...>

Hi all

13 messages 2006/07/06

[#8248] One-Click Installer: MinGW? or VC2005? — "Curt Hibbs" <ml.chibbs@...>

I just posted this to ruby-talk. But I would also like to discuss this

33 messages 2006/07/18
[#8264] Re: One-Click Installer: MinGW? or VC2005? — Charlie Savage <cfis@...> 2006/07/19

From my experience using both tool chains on Windows (for the ruby-prof

[#8266] Re: One-Click Installer: MinGW? or VC2005? — "Curt Hibbs" <ml.chibbs@...> 2006/07/19

Tim, I'm going to top reply since your post was so long. I'm interested in

[#8267] Re: One-Click Installer: MinGW? or VC2005? — Charlie Savage <cfis@...> 2006/07/19

> Tim, I'm going to top reply since your post was so long. I'm interested in

[#8271] my sandboxing extension!! — why the lucky stiff <ruby-core@...>

I have (what feels like) very exciting news. I finally sat down to code up my

17 messages 2006/07/19

[#8430] Re: doc patch: weakref. — "Berger, Daniel" <Daniel.Berger@...>

> -----Original Message-----

19 messages 2006/07/28
[#8434] Re: doc patch: weakref. — Yukihiro Matsumoto <matz@...> 2006/07/29

Hi,

[#8436] Re: doc patch: weakref. — Daniel Berger <djberg96@...> 2006/07/29

Yukihiro Matsumoto wrote:

[#8437] Re: doc patch: weakref. — Mauricio Fernandez <mfp@...> 2006/07/29

On Sat, Jul 29, 2006 at 07:37:24PM +0900, Daniel Berger wrote:

[#8441] Inconsistency in scoping during module_eval? — "Charles O Nutter" <headius@...>

I have the following code:

18 messages 2006/07/30
[#8442] Re: Inconsistency in scoping during module_eval? — nobu@... 2006/07/30

Hi,

[#8443] Re: Inconsistency in scoping during module_eval? — "Charles O Nutter" <headius@...> 2006/07/30

Why does this:

[#8445] Re: Inconsistency in scoping during module_eval? — Yukihiro Matsumoto <matz@...> 2006/07/30

Hi,

[#8454] Re: Inconsistency in scoping during module_eval? — "Charles O Nutter" <headius@...> 2006/07/31

So to clarify...

Re: [PATCH] --fqname option to test/unit/autorunner.rb

From: "Daniel Berger" <Daniel.Berger@...>
Date: 2006-07-13 19:26:51 UTC
List: ruby-core #8213
Sam Roberts wrote:

<snip>

> 
> One question, could the syntax of --name be extended, so if there is a #
> or a :: in it is referring to a specific test name in a specific test
> suite? I think it would be useful to just have a single option, a bit
> like rdoc, if it is specific enough it will run one test, if not it will
> run multiple. Just a thought.
> 
> Thanks,
> Sam

Hm, good idea, so I've attached a patch that does that. :)

Note that it only works on strings passed to -n, not regular expressions.

Anyway, given the following test file:

# ts_all.rb
require 'test/unit'

class Foo
    def stuff
       "foo"
    end
end

class Bar
    def stuff
       "bar"
    end
end

class TC_Foo < Test::Unit::TestCase
    def setup
       @foo = Foo.new
    end

    def test_stuff
       assert_equal("foo", @foo.stuff)
    end

    def teardown
       @foo = nil
    end
end

class TC_Bar < Test::Unit::TestCase
    def setup
       @bar = Bar.new
    end

    def test_stuff
       assert_equal("bar", @bar.stuff)
       assert_equal(1,1)
    end

    def teardown
       @bar = nil
    end
end

You get these results:

# Runs all tests that match 'test_stuff'
 >ruby tstest.rb -n test_stuff
Loaded suite tstest
Started
..
Finished in 0.002937 seconds.

2 tests, 3 assertions, 0 failures, 0 errors

# Only runs test_stuff from TC_Bar
 >ruby tstest.rb -n TC_Bar#test_stuff
Loaded suite tstest
Started
.
Finished in 0.002202 seconds.

1 tests, 2 assertions, 0 failures, 0 errors

# Only runs test_stuff from TC_Foo
 >ruby tstest.rb -n TC_Foo#test_stuff
Loaded suite tstest
Started
.
Finished in 0.002114 seconds.

1 tests, 1 assertions, 0 failures, 0 errors

Enjoy!

Dan


This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful.  If you have received this communication 
in error, please immediately notify the sender by reply e-mail and destroy 
all copies of the communication and any attachments.

Attachments (1)

autorunner.diff (942 Bytes, text/x-patch)
--- autorunner.orig	Thu Jul 13 12:50:03 2006
+++ autorunner.rb	Thu Jul 13 13:14:38 2006
@@ -133,11 +133,23 @@
                "Runs tests matching NAME.",
                "(patterns may be used).") do |n|
             n = (%r{\A/(.*)/\Z} =~ n ? Regexp.new($1) : n)
+
             case n
             when Regexp
-              @filters << proc{|t| n =~ t.method_name ? true : nil}
+              @filters << proc{ |t|
+                n =~ t.method_name ? true : nil
+              }
             else
-              @filters << proc{|t| n == t.method_name ? true : nil}
+              if n =~ /#/
+                klass, n = n.split('#')
+              end
+              @filters << proc{ |t|
+                if klass
+                  klass == t.class.to_s && n == t.method_name ? true : nil
+                else
+                  n == t.method_name ? true : nil
+                end
+              }
             end
           end
 

In This Thread