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
|
# File 'lib/xamplr-pp/toys/chew.rb', line 18
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
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
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
|