Sha256: 70275c748939a333515e7cfcc797ac1f58a6427cbf11d4e73887440b944cae56

Contents?: true

Size: 1.45 KB

Versions: 6

Compression:

Stored size: 1.45 KB

Contents

#!/usr/local/bin/ruby
require "xampl-pp-wf"
#require "xampl-pp"

class Chew

	def resolve(name)
		@resolveRequest = true
#		if not @xpp.standalone then
#			# for the purposes of conformance, accept this since we don't
#			# know if the external subset defines something
#			return "fake it"
#		else
#			return nil
#		end
	end

	def run
		@allFiles = File.new ARGV[1]

		while true do
			fileName = @allFiles.gets
			if nil == fileName then
				break
			end
			fileName.chop!

			@xpp = Xampl_PP.new
			@xpp.input = File.new(fileName)
@xpp.resolver = self
@resolveRequest = false
@xpp.processNamespace = false
@xpp.reportNamespaceAttributes = false
		
			begin
				i = 0
				while not @xpp.endDocument? do
					type = @xpp.nextEvent
					i += 1
				end
				printf("%sPASSED '%s' -- there were %d events\n", (("PASS" == ARGV[0])? " " : "#"), fileName, i)
			rescue RuntimeError => message
				#print message.backtrace.join("\n")
				if @resolveRequest then
					printf("ENTITY [%s] '%s'\n", (("FAIL" == ARGV[0])? " " : "#"), message, fileName)
				else
					printf("%sFAILED [%s] '%s'\n", (("FAIL" == ARGV[0])? " " : "#"), message, fileName)
				end
			rescue Exception => message
				#print message.backtrace.join("\n")
				if @resolveRequest then
					printf("ENTITY [%s] '%s'\n", (("FAIL" == ARGV[0])? " " : "#"), message, fileName)
				else
					printf("%sFAILED [%s] '%s'\n", (("FAIL" == ARGV[0])? " " : "#"), message, fileName)
				end
			end
		end
	end
end

chew = Chew.new
chew.run

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
hutch-xamplr-pp-1.0.0 lib/xamplr-pp/toys/chew.rb
hutch-xamplr-pp-1.1.0 lib/xamplr-pp/toys/chew.rb
hutch-xamplr-pp-1.1.2 lib/xamplr-pp/toys/chew.rb
xamplr-pp-1.2.0 lib/xamplr-pp/toys/chew.rb
xamplr-pp-1.1.4 lib/xamplr-pp/toys/chew.rb
xamplr-pp-1.0.0 lib/xamplr-pp/toys/chew.rb