is this a unit/test bug?

R

Roger Pack

C:\dev\ruby\ties>ruby
C:\dev\ruby\ties\test\functional\store_controller_test.rb
-ntest_gives_single_discount

# this one works ^^^^^^

# this one fails vvvvvv

C:\dev\ruby\ties>ruby
C:\dev\ruby\ties\test\functional\store_controller_test.rb
--testcase=test_gives_single_discount
C:/dev/ruby/ties/test/functional/../test_helper
Loaded suite C:/dev/ruby/ties/test/functional/store_controller_test
Started

Finished in 0.0 seconds.

0 tests, 0 assertions, 0 failures, 0 errors

but --testcase is supposed to be a test pattern...anybody know what's
going on here? I'm thinking this is a bug.
-r
 
C

Caleb Clausen

C:\dev\ruby\ties>ruby
C:\dev\ruby\ties\test\functional\store_controller_test.rb
-ntest_gives_single_discount

# this one works ^^^^^^

# this one fails vvvvvv

C:\dev\ruby\ties>ruby
C:\dev\ruby\ties\test\functional\store_controller_test.rb
--testcase=test_gives_single_discount
C:/dev/ruby/ties/test/functional/../test_helper
Loaded suite C:/dev/ruby/ties/test/functional/store_controller_test
Started

Finished in 0.0 seconds.

0 tests, 0 assertions, 0 failures, 0 errors

but --testcase is supposed to be a test pattern...anybody know what's
going on here? I'm thinking this is a bug.

As far as I know, the -n (or --name) parameter to test/unit gives the
name of a test method (or methods) to be run. The -t (or --testcase)
parameter gives the name of a test class. So, it looks like the second
command didn't do what you want because there's no class named
test_gives_single_discount.

PS: if you want to use a pattern (regex) in names used by -n and -t, I
think you have to enclose the name in slashes. (eg: -n
/test_gives_single_discount/ )
 
R

Ryan Davis

test_gives_single_discount

# this one works ^^^^^^

# this one fails vvvvvv

test_gives_single_discount

but --testcase is supposed to be a test pattern...anybody know what's
going on here? I'm thinking this is a bug.

no, --testcase MAY take a pattern, and you didn't provide one
(patterns start with "/" like default regexps). But that isn't your
problem. This should shed some light:

502 % ruby -rtest/unit -e 0 -- --help
Test::Unit automatic runner.
Usage: -e [options] [-- untouched arguments]

...
-n, --name=NAME Runs tests matching NAME.
(patterns may be used).
-t, --testcase=TESTCASE Runs tests in TestCases matching
TESTCASE.
(patterns may be used).
...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top