# Test/unit filters question/suggestion

**URL:** <https://www.ruby-forum.com/t/test-unit-filters-question-suggestion/97329>\
**Category:** Ruby\
**Created:** [July 6, 2006, 12:00pm UTC](https://www.ruby-forum.com/t/test-unit-filters-question-suggestion/97329 "2006-07-06T12:00:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![crenner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/278dde/32.png) [@crenner](https://www.ruby-forum.com/u/crenner)\
**Post date:** [July 6, 2006, 12:00pm UTC](https://www.ruby-forum.com/t/test-unit-filters-question-suggestion/97329/1 "2006-07-06T12:00:33Z")

</div>

When using the test/unit autorunner, you are able to supply some  
options. Two of these options are -t (–testcase) and -n (–name); to  
run only a given testcase or tests matching a given name respectively.  
These two filters don’t get combined. If I have two test cases  
containing a test of the same name, I’d expect to be able to specify  
the exact test to run using both -t and -n. Currently -n appears to  
take priority and therefore both test methods will be run. Is this  
explicit by design or a result of my (potentially unusual) test  
construction?

I just had a quick look at combining filters but my efforts were  
hampered by the inclusion of a default filter that always evaluates to  
false (set in AutoRunner#process\_args). My solution was to be to run  
through all filters (in Collector#include?) for a given method rather  
than returning prematurely as in the current implementation. Does  
anyone have any insight as to the purpose of the default   
filter?

Cheers,

Chris

---

<div class="post-metadata">

**Author:** ![crenner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/278dde/32.png) [@crenner](https://www.ruby-forum.com/u/crenner)\
**Post date:** [July 6, 2006, 9:11pm UTC](https://www.ruby-forum.com/t/test-unit-filters-question-suggestion/97329/2 "2006-07-06T21:11:34Z")

</div>

On Jul 6, 2006, at 3:00 AM, Chris R. wrote:

> When using the test/unit autorunner, you are able to supply some  
> options. Two of these options are -t (–testcase) and -n (–name); to  
> run only a given testcase or tests matching a given name respectively.  
> These two filters don’t get combined. If I have two test cases  
> containing a test of the same name, I’d expect to be able to specify  
> the exact test to run using both -t and -n. Currently -n appears to  
> take priority and therefore both test methods will be run. Is this  
> explicit by design or a result of my (potentially unusual) test  
> construction?

I looked into this and found it filtered for the union of all options  
rather than the intersection.

> I just had a quick look at combining filters but my efforts were  
> hampered by the inclusion of a default filter that always evaluates to  
> false (set in AutoRunner#process\_args). My solution was to be to run  
> through all filters (in Collector#include?) for a given method rather  
> than returning prematurely as in the current implementation. Does  
> anyone have any insight as to the purpose of the default   
> filter?

I built a patch that seemed to produce an intersection behavior, let  
me try to dig it up. Nathaniel T. was semi-interested in the idea.

–  
Eric H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)

---

<div class="post-metadata">

**Author:** ![crenner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/278dde/32.png) [@crenner](https://www.ruby-forum.com/u/crenner)\
**Post date:** [July 10, 2006, 3:08pm UTC](https://www.ruby-forum.com/t/test-unit-filters-question-suggestion/97329/3 "2006-07-10T15:08:41Z")

</div>

On 7/6/06, Eric H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > construction?  
> > filter?
> 
> I built a patch that seemed to produce an intersection behavior, let  
> me try to dig it up. Nathaniel T. was semi-interested in the idea.

Hi Eric,

Did you find your patch at all?

Chris
