Test::Unit mixup

W

Warren Seltzer

------=_NextPart_000_0078_01C646E3.9EA74280
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

Suddenly test::unit is failing for me. The following 2-line script comes up with

"testu.rb:2: undefined method `assert' for main:Object (NoMethodError)"

testu.rb contains:

1: require 'test/unit'
2: assert(1==1)

What have I broken or forgot?
ruby 1.8.2 (2004-12-25) [i386-mswin32]

It fails the same way under irb.

Warren


------=_NextPart_000_0078_01C646E3.9EA74280--
 
P

Pit Capitain

Warren said:
Suddenly test::unit is failing for me. The following 2-line script comes up with

"testu.rb:2: undefined method `assert' for main:Object (NoMethodError)"

testu.rb contains:

1: require 'test/unit'
2: assert(1==1)

What have I broken or forgot?
ruby 1.8.2 (2004-12-25) [i386-mswin32]

Hi Warren,

normally the assert methods are accessible in subclasses of
Test::Unit::TestCase. You could change your code to

require 'test/unit'
class AssertionTest < Test::Unit::TestCase
def test_assert
assert(1==1)
end
end

If you want to use assertions outside of testcases, look at module
Test::Unit::Assertions.

Regards,
Pit
 

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

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,156
Latest member
KetoBurnSupplement
Top