From: Jeff Wood Date: 2005-08-27T07:30:53+09:00 Subject: Re: Asserting files are not different in Test::Unit? Hows about assert( FileUtils.compare_file('somefile', 'somefile') ) j. On 8/26/05, David Brady wrote: > I am writing some document generation classes now, and testing them with > Test::Unit. The documents are 20-50k in size, and as a good initial > test I'd like to simply generate a document and compare it against the > output of the existing document generator. > > What are some good Rubyish ways of doing this? > > Is there a Ruby Way to diff text files? > > Is there a Ruby Way to assert that two text files are the same? > > I suppose I could just write a wrapper to a system call to diff. > > Alternately, I could wrapper a method in Test::Unit to read a file into > a gigantic string, and assert_equal that against the contents of another > string. The fail message from this, however, would not only be useless > (100k of text to the console!), but would blind the system to other fail > messages useless as well. > > Thoughts? > > -dB > > -- > David Brady > ruby_talk@shinybit.com > I'm feeling really surreal today... OR AM I? > > > -- "So long, and thanks for all the fish" Jeff Wood