From 1e51de46ec10fe06598ae0dd5fa3be9fa715e3e8 Mon Sep 17 00:00:00 2001 From: lnu Date: Thu, 15 Sep 2005 07:58:14 +0000 Subject: tests for unescaped html git-svn-id: svn+ssh://svn.gna.org/svn/feed2imap/trunk/feed2imap@60 f70e237a-67f3-0310-a06c-d2b8a7116972 --- test/tc_parser.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'test/tc_parser.rb') diff --git a/test/tc_parser.rb b/test/tc_parser.rb index 89339f0..d95304c 100755 --- a/test/tc_parser.rb +++ b/test/tc_parser.rb @@ -9,6 +9,7 @@ class ParserTest < Test::Unit::TestCase DATADIR = 'test/parserdata' def test_parser return if not File::exist?(DATADIR) + allok = true Dir.foreach(DATADIR) do |f| next if f !~ /.xml$/ str = File::read(DATADIR + '/' + f) @@ -18,15 +19,20 @@ class ParserTest < Test::Unit::TestCase chanstr = chanstr.unpack('U*').pack('C*') if File::exist?(DATADIR + '/' + f.gsub(/.xml$/, '.output')) output = File::read(DATADIR + '/' + f.gsub(/.xml$/, '.output')) - File::open(DATADIR + '/' + f.gsub(/.xml$/, '.output.new'), "w") do |f| - f.print(chanstr) + File::open(DATADIR + '/' + f.gsub(/.xml$/, '.output.new'), "w") do |fd| + fd.print(chanstr) + end + if output != chanstr + puts "Test failed for #{f}. Try diff -u #{DATADIR + '/' + f.gsub(/.xml$/, '.output')}{,.new}" + allok = false end - assert_equal(output, chanstr) else + puts "Missing #{DATADIR + '/' + f.gsub(/.xml$/, '.output')}." File::open(DATADIR + '/' + f.gsub(/.xml$/, '.output.new'), "w") do |f| f.print(chanstr) end end + assert(allok) end end end -- cgit v1.2.3-54-g00ecf