1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
#!/usr/bin/ruby
# This file is part of the syndication library
#
# SPDX-FileCopyrightText: 2005 Frank Osterfeld <osterfeld@kde.org>
#
# SPDX-License-Identifier: LGPL-2.0-or-later
SUBDIRS = [ 'rss2', 'rdf', 'atom' ]
TESTLIBSYNDICATION='../../build/syndication/tests/testlibsyndication'
numTotal = 0
numErrors = 0
files = Array.new
SUBDIRS.each do |dir|
Dir.foreach(dir) do |i|
files.push(dir + "/" + i) if i =~ /.*\.xml\Z/
end
end
files.each do |file|
expectedfn = file + ".expected"
if File.exist?(expectedfn)
expFile = File.open(expectedfn, "r")
expected = expFile.read
expFile.close
system("#{TESTLIBSYNDICATION} #{file} > testfeeds-output.tmp")
actFile = File.open("testfeeds-output.tmp")
actual = actFile.read
actFile.close
numTotal += 1
if actual != expected
puts "#{file} parsed incorrectly (abstraction)."
# TODO: add diff to log
numErrors += 1
end
end
specificfn = file + ".expected-specific"
if File.exist?(specificfn)
specFile = File.open(specificfn, "r")
specific = specFile.read
specFile.close
system("#{TESTLIBSYNDICATION} --specific-format #{file} > testfeeds-output.tmp")
actFile = File.open("testfeeds-output.tmp")
actual = actFile.read
actFile.close
numTotal += 1
if actual != specific
puts "#{file} parsed incorrectly (specific format)."
# TODO: add diff to log
numErrors += 1
end
end
end
# TODO print more verbose output
exit(numErrors)
|