Hi Hugh,
Hugh Sasse Staff Elec Eng wrote:
I don't use Scite, so can't be sure how this interacts.
Presumably you get the same results outside of Scite?
Yes, when I used it on the command line as:
e:\ruby\scite\ruby test_unit.rbw
I got the same error.
Loaded suite Test_Unit.rbw
Started
F
Finished in 0.05 seconds.
1) Failure:
test_wrap(TC_StringWrapper) [Test_Unit.rbw:11]:
The line should have been wrapped to 9 columns.
<"This is a\nwrapped\nline."> expected but was
<"">.
1 tests, 1 assertions, 1 failures, 0 errors
Exit code: 1
We'd really need to see your code to be able to reproduce this, and
to be sure that it doesn't differ significantly from the example.
require 'test/unit'
require 'string_wrapper' #NOTE: I ALSO TRIED _.RB AND _.RBW HERE
class TC_StringWrapper < Test::Unit::TestCase
def test_wrap
wrapper = StringWrapper.new
assert_equal("This is a\nwrapped\nline.",
wrapper.wrap("This is a wrapped line.", 9),
"The line should have been wrapped to 9 columns")
end
end
and string_wrapper.rbw ( also made a string_wrapper.rb just to be sure ):
class StringWrapper
def wrap( string, columns )
string.scan(/(.{1,9}) (?: |$)/).join("\n")
end
end
We could probably do with knowing what versions of Ruby and Test Unit
you are using.
Ruby 1.8.2 and whatever Test Unit comes with it.
All we can say now is that it is clear the assert statement is
getting an empty string, but from what I can's see.
Any thoughts, or other links, would be appreciated.
Thanks for your link, and I'm currently looking at:
http://www.ruby-doc.org/stdlib/libdoc/test/unit/rdoc/index.html
The example there with:
require 'test/unit'
class TC_MYTest < Test::Unit::TestCase
def test_fail
assert(false, 'Assertion was false.')
end
end
works as stated. But I need some more hand holding to get it to judge my own work.
Thanks,
Barry