testdata 0.8.8 → 0.8.10
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -2
- data/lib/testdata.rb +26 -14
- metadata +9 -9
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4acfb64c6128ab313d8cce5965ff06a0afd4075
|
4
|
+
data.tar.gz: 79f14e01ed47a6600e3d0f333f2b266616d432ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 901b534e449cd24c6f173139f8aa00554aa5e8679b725a929b18b0214639ffbb6a641f108834bb77a259e2c5caff718dc199681a4b04f7c9f07499351a30b3d7
|
7
|
+
data.tar.gz: de116d18fac601508cc40b64c7397f27adae5d1465b58e0aa4b59aa85b52b61b1ae0acc9c449b96707bb3b44daa2bc89c04756e225b79a833c03e49ea15f8278
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
lTܮe1�߱�l]sK(@��da�/�M�μX�?:V����R�1��\�,ç,�@�
|
2
|
+
I�>D�/B�C5���W+Z����[M]���uO[8z���bqS���^�y�(�;I/�N�^����[H�^-û�=�Z��6��Udrz���m��Yءs� P�!�'a������"�#9_�g���[~�����@J���#�x�:XO���pm�^}�+�L�'��G0���h(p-�pr.ɏ� P\\�TeԷ
|
data/lib/testdata.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/bin/ruby
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# file: testdata.rb
|
4
4
|
|
@@ -13,7 +13,10 @@ class Testdata
|
|
13
13
|
attr_accessor :debug
|
14
14
|
|
15
15
|
def initialize(s, options={})
|
16
|
-
|
16
|
+
super()
|
17
|
+
@params = {}
|
18
|
+
#routes()
|
19
|
+
|
17
20
|
@success = [] # used by summary
|
18
21
|
@debug = false
|
19
22
|
|
@@ -42,7 +45,8 @@ class Testdata
|
|
42
45
|
|
43
46
|
stringify = Proc.new do |x|
|
44
47
|
r = x.text.to_s.gsub(/^[\n\s]+/,'').length > 0 ? x.text : x.cdatas.join.strip
|
45
|
-
REXML::Text::unnormalize(r)
|
48
|
+
#REXML::Text::unnormalize(r)
|
49
|
+
r
|
46
50
|
end
|
47
51
|
|
48
52
|
node = XPath.first(@doc.root, "records/test[summary/path='#{id}']")
|
@@ -52,7 +56,8 @@ class Testdata
|
|
52
56
|
|
53
57
|
xpath = "records/io/summary[type='input']/*"
|
54
58
|
input_nodes = XPath.match(node, xpath)[1..-1]
|
55
|
-
input_values = input_nodes.map(&stringify)
|
59
|
+
input_values = input_nodes.map(&stringify) + []
|
60
|
+
|
56
61
|
input_names = input_nodes.map(&:name)
|
57
62
|
|
58
63
|
# find the type or description
|
@@ -70,6 +75,7 @@ class Testdata
|
|
70
75
|
@debug2 = debug2 ? true : false
|
71
76
|
@success = []
|
72
77
|
procs = {NilClass: :test_all, Range: :test_all, String: :test_id, Fixnum: :test_id}
|
78
|
+
|
73
79
|
method(procs[x.class.to_s.to_sym]).call(x)
|
74
80
|
summary()
|
75
81
|
end
|
@@ -78,14 +84,15 @@ class Testdata
|
|
78
84
|
x ||=(0..-1)
|
79
85
|
|
80
86
|
XPath.match(@doc.root, "records/test/summary/path/text()")[x].each do |id|
|
81
|
-
puts 'id : ' + id.to_s
|
82
87
|
test_id(id)
|
83
88
|
end
|
84
89
|
end
|
85
90
|
|
86
91
|
def test_id(id='')
|
87
92
|
|
88
|
-
path_no,
|
93
|
+
path_no, inputs, input_names, tod, expected = testdata_values(id.to_s)
|
94
|
+
|
95
|
+
@inputs = inputs
|
89
96
|
tests() # load the routes
|
90
97
|
raw_actual = run_route tod
|
91
98
|
|
@@ -98,10 +105,12 @@ class Testdata
|
|
98
105
|
|
99
106
|
a = raw_actual.is_a?(String) ? [raw_actual].flatten.map(&:strip) : raw_actual
|
100
107
|
b = expected.map(&:strip)
|
101
|
-
|
108
|
+
#puts 'b :' + b.inspect
|
102
109
|
if @debug == true or @debug2 == true then
|
103
|
-
|
110
|
+
|
111
|
+
inputs = input_names.zip(inputs).map{|x| ' ' + x.join(": ")}\
|
104
112
|
.join("\n")
|
113
|
+
|
105
114
|
puts "\ninputs: \n" + inputs
|
106
115
|
puts "\ntype or description:\n " + tod
|
107
116
|
puts "\nexpected : \n " + b.inspect
|
@@ -115,8 +124,7 @@ class Testdata
|
|
115
124
|
|
116
125
|
rescue Exception => e
|
117
126
|
err_label = e.message + " :: \n" + e.backtrace.join("\n")
|
118
|
-
|
119
|
-
puts err_label
|
127
|
+
raise 'testdata :' + err_label
|
120
128
|
result = false
|
121
129
|
ensure
|
122
130
|
@success[-1][0] = result
|
@@ -126,7 +134,7 @@ class Testdata
|
|
126
134
|
def tests(*args)
|
127
135
|
# override this method in the child class
|
128
136
|
end
|
129
|
-
|
137
|
+
|
130
138
|
def read_file(s)
|
131
139
|
buffer = File.open(s, 'r').read
|
132
140
|
ext = url[/\.(\w+)$/,1]
|
@@ -142,11 +150,15 @@ class Testdata
|
|
142
150
|
def read_xml(buffer)
|
143
151
|
buffer
|
144
152
|
end
|
153
|
+
|
154
|
+
def read_td(buffer)
|
155
|
+
TestdataText.parse buffer
|
156
|
+
end
|
157
|
+
|
145
158
|
|
146
|
-
|
147
159
|
def test(s)
|
148
160
|
@inputs = @inputs.first if @inputs.length == 1
|
149
|
-
|
161
|
+
self.add_route(s){yield(@inputs)}
|
150
162
|
end
|
151
163
|
|
152
164
|
def summary()
|
@@ -158,4 +170,4 @@ class Testdata
|
|
158
170
|
failed: @success.select{|x| x[0] == false}.map(&:last).sort
|
159
171
|
}
|
160
172
|
end
|
161
|
-
end
|
173
|
+
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.8.
|
4
|
+
version: 0.8.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -29,34 +29,34 @@ cert_chain:
|
|
29
29
|
v6gR0L2xBdI+YSHZD9YesDj3p86qeGXWwmk/NFuo/Z8BugdhOC6UclzbmtvM1MCs
|
30
30
|
+/pkQFGFkmwcWwLt2EJHryF/SPfCbewq
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2013-
|
32
|
+
date: 2013-12-24 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: app-routes
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
type: :runtime
|
42
42
|
prerelease: false
|
43
43
|
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: testdata_text
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
description:
|
@@ -76,17 +76,17 @@ require_paths:
|
|
76
76
|
- lib
|
77
77
|
required_ruby_version: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- -
|
79
|
+
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
|
-
- -
|
84
|
+
- - ">="
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '0'
|
87
87
|
requirements: []
|
88
88
|
rubyforge_project:
|
89
|
-
rubygems_version: 2.0.
|
89
|
+
rubygems_version: 2.0.3
|
90
90
|
signing_key:
|
91
91
|
specification_version: 4
|
92
92
|
summary: testdata
|
metadata.gz.sig
CHANGED
Binary file
|