Thank you!
	The "space" was an error and it now runs correctly.  FWIW, an earlier 
error (yesterday) was leaving out the "require" for the file that held 
the StringWrapper class.  Now if I could only figure out what is going 
on here...
	Barry


Hugh Sasse Staff Elec Eng wrote:

> On Thu, 3 Feb 2005, Barry Sperling wrote:
> 
>> 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.
>>
>         [...]
> 
>>>>  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")
> 
> 
> Should be
>          string.scan(/(.{1,9})(?: |$)/).join("\n")
> i.e no space between ) and ( because the regular expression will look
> for that space.
> 
>>     end
>> end
> 
> 
> And I think you get an empty string because
> /.{1,9)  / and /.{1,9} $/ never match the input. There is no double
> space, and there is no [space][end of line], / $/.
> 
>>
>>> 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.
> 
> 
> Thanks
> 
>>
>>>
>>> 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:
> 
>         [...]
> 
>>         assert(false, 'Assertion was false.')
> 
>         [...]
> 
>>
>> works as stated.  But I need some more hand holding to get it to judge 
>> my own work.
>> Thanks,
>>     Barry
>>
>         HTH
>         Hugh
> 
>>
>>
>>
> 
>