testdata 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/testdata.rb +8 -11
  2. metadata +1 -1
data/lib/testdata.rb CHANGED
@@ -32,12 +32,16 @@ end
32
32
  class Path
33
33
  include REXML
34
34
 
35
- def initialize(doc) @doc = doc end
35
+ def initialize(doc, success) @doc, @success = doc, success end
36
36
 
37
37
  def tested? description
38
38
  node = XPath.first(@doc.root, "records/test[summary/description='#{description}']")
39
39
  raise "Path error: node not found" unless node
40
- yield *%w(input output).map {|x| Select.new(x,node)}
40
+ begin
41
+ @success << yield(*%w(input output).map {|x| Select.new(x,node)})
42
+ rescue
43
+ @success << false
44
+ end
41
45
  end
42
46
  end
43
47
 
@@ -53,17 +57,10 @@ class Testdata
53
57
  @success = []
54
58
  end
55
59
 
56
- def paths()
57
- begin
58
- @success << yield(path = Path.new(@doc))
59
- rescue
60
- @success << false
61
- end
62
- end
60
+ def paths() yield(path = Path.new(@doc, @success)) end
63
61
  def read_file(s) File.open(s, 'r').read end
64
62
  def read_url(xml_url) open(xml_url, 'UserAgent' => 'S-Rscript').read end
65
63
 
66
64
  def passed?() @success.all? end
67
- def score() [@success.grep(true), @success].map(&:length).join('/') end
68
-
65
+ def score() [@success.grep(true), @success].map(&:length).join('/') end
69
66
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testdata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors: []
7
7