File indexing completed on 2025-02-02 14:22:09
0001 #!/usr/bin/ruby 0002 0003 # This file is part of the syndication library 0004 # 0005 # SPDX-FileCopyrightText: 2005 Frank Osterfeld <osterfeld@kde.org> 0006 # 0007 # SPDX-License-Identifier: LGPL-2.0-or-later 0008 0009 SUBDIRS = [ 'rss2', 'rdf', 'atom' ] 0010 0011 TESTLIBSYNDICATION='../../build/syndication/tests/testlibsyndication' 0012 0013 numTotal = 0 0014 numErrors = 0 0015 0016 files = Array.new 0017 0018 SUBDIRS.each do |dir| 0019 Dir.foreach(dir) do |i| 0020 files.push(dir + "/" + i) if i =~ /.*\.xml\Z/ 0021 end 0022 end 0023 0024 files.each do |file| 0025 expectedfn = file + ".expected" 0026 if File.exist?(expectedfn) 0027 expFile = File.open(expectedfn, "r") 0028 expected = expFile.read 0029 expFile.close 0030 0031 system("#{TESTLIBSYNDICATION} #{file} > testfeeds-output.tmp") 0032 actFile = File.open("testfeeds-output.tmp") 0033 actual = actFile.read 0034 actFile.close 0035 0036 numTotal += 1 0037 if actual != expected 0038 puts "#{file} parsed incorrectly (abstraction)." 0039 # TODO: add diff to log 0040 numErrors += 1 0041 end 0042 0043 end 0044 specificfn = file + ".expected-specific" 0045 if File.exist?(specificfn) 0046 specFile = File.open(specificfn, "r") 0047 specific = specFile.read 0048 specFile.close 0049 0050 system("#{TESTLIBSYNDICATION} --specific-format #{file} > testfeeds-output.tmp") 0051 actFile = File.open("testfeeds-output.tmp") 0052 actual = actFile.read 0053 actFile.close 0054 0055 numTotal += 1 0056 if actual != specific 0057 puts "#{file} parsed incorrectly (specific format)." 0058 # TODO: add diff to log 0059 numErrors += 1 0060 end 0061 0062 end 0063 0064 end 0065 # TODO print more verbose output 0066 exit(numErrors) 0067