testdata 1.0.4 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7549622d6568e1556f0b7d370a830cfda28599c
4
- data.tar.gz: 334cb9a439360183fc928cf4e60da7ddda55cc43
3
+ metadata.gz: 321ab0efd274b275e64a3cd598642c46c32df2ff
4
+ data.tar.gz: 05440ca112a12d415c6031334ef568346ef9fb91
5
5
  SHA512:
6
- metadata.gz: c4c9c61c2f909ce33aefb5d969075f5e1c36cec4f7d22f96fab1ff4383ec95ded1dc684c59b835d713304a885ef205dbb5f4d65b03c00c9367ef2547be532370
7
- data.tar.gz: 41ed95240df4962e1c0571576c302950f5b522ecfb5d7e8e38ba6f513e4f466a61829a2b0134589a5b9024a79c5eb189a8757875d3011ebbced2a98062781b06
6
+ metadata.gz: ac00ad5c69517d92358d4c8942a9b5f0ac8c5b90d466ca3ed1d874b90f9d9d03164aa7cca634f06d767c6f9e1051410d0c991c73869042a353cbff98a2179686
7
+ data.tar.gz: 4e22e0f9256b2fe17e0edb6eb1f847ea1bbfee0ae0320c907edca183cc7a8230f00cc1a9d849da7e247d1f543c8b30fe0db719f975cf9d8eaa6569b21bf097d6
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -5,6 +5,7 @@
5
5
  require 'app-routes'
6
6
  require 'testdata_text'
7
7
  require 'diffy'
8
+ require 'dynarex'
8
9
 
9
10
 
10
11
  class TestdataException < Exception
@@ -43,6 +44,7 @@ module Testdata
43
44
  }
44
45
 
45
46
  buffer = procs[s.class.to_s.to_sym].call(s)
47
+
46
48
  @doc = Rexle.new(buffer)
47
49
 
48
50
  o = {log: false}.merge(options)
@@ -69,9 +71,11 @@ module Testdata
69
71
 
70
72
  path_no = node.text('summary/path')
71
73
  #puts 'path_no : ' + path_no.inspect
72
- xpath = "records/input/summary/*"
74
+ input_summary = node.element 'records/input/summary'
75
+ input_summary.delete 'schema | format_mask | recordx_type'
76
+
73
77
  #puts 'node : ' + node.xml.inspect
74
- input_nodes = node.xpath(xpath) #[1..-1]
78
+ input_nodes = input_summary.xpath('*') #[1..-1]
75
79
  #puts 'input:nodes : ' + input_nodes.inspect
76
80
  input_values = input_nodes.map{|x| x.texts.join.strip} + []
77
81
 
@@ -82,8 +86,10 @@ module Testdata
82
86
  summary = node.element 'summary'
83
87
  type, desc = summary.text('type'), summary.text('description')
84
88
 
85
- xpath = "records/output/summary/*"
86
- output_nodes = node.xpath(xpath) #[1..-1]
89
+ output_summary = node.element 'records/output/summary'
90
+ output_summary.delete 'schema | format_mask | recordx_type'
91
+
92
+ output_nodes = output_summary.xpath('*') #[1..-1]
87
93
  output_values = output_nodes.map{|x| x.texts.map(&:unescape).join.strip}
88
94
 
89
95
  [path_no, input_values, input_names, type, output_values, desc]
@@ -165,6 +171,49 @@ module Testdata
165
171
  def tests(*args)
166
172
  # override this method in the child class
167
173
  end
174
+
175
+ def read_rdx(buffer)
176
+
177
+ dx = Dynarex.new
178
+ dx.import buffer
179
+
180
+ sfields = dx.summary.keys - [:recordx_type, :format_mask, :schema, \
181
+ :default_key, :delimiter]
182
+
183
+
184
+ raw_inputs, raw_outputs = dx.fields.partition {|x| x[/_in$/]}
185
+
186
+ inputs = raw_inputs.map{|x| x.to_s[0..-4]}
187
+ outputs = raw_outputs.map{|x| x.to_s[0..-5]}
188
+ child_schema = "input[%s];output[%s]" % [inputs.join(','), outputs.join(',')]
189
+
190
+ px = Polyrex.new "tests[title, ruby_version, script, test_dir]" \
191
+ + "/test[path,type,description]/{#{child_schema}}"
192
+
193
+ sfields.each do |x|
194
+ px.summary.send((x.to_s + '=').to_sym, dx.method(x).call)
195
+ end
196
+
197
+ dx.all.each.with_index do |x, i|
198
+
199
+ px.create.test(path: (i+1).to_s, type: dx.test_type) do |create|
200
+
201
+ raw_inputs.each do |fld_in|
202
+ create.input(fld_in[0..-4].to_sym => \
203
+ x.method(fld_in.to_sym).call)
204
+ end
205
+
206
+ raw_outputs.each do |fld_out|
207
+ create.output(fld_out[0..-5].to_sym => \
208
+ x.method(fld_out.to_sym).call)
209
+ end
210
+ end
211
+
212
+ end
213
+
214
+ px.to_xml
215
+
216
+ end
168
217
 
169
218
  def read_file(s)
170
219
  buffer = File.open(s, 'r').read
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: 1.0.4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  OER61xm4PXti/ej9K/nvEIwOfuMNhq+yrO8pETyuCV/Gtma9e5tIgCRz7ZUbydZv
32
32
  r8AWz+GWk3lj5g==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-04-21 00:00:00.000000000 Z
34
+ date: 2015-07-30 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: app-routes
@@ -93,6 +93,26 @@ dependencies:
93
93
  - - ">="
94
94
  - !ruby/object:Gem::Version
95
95
  version: 3.0.7
96
+ - !ruby/object:Gem::Dependency
97
+ name: dynarex
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '1.5'
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: 1.5.33
106
+ type: :runtime
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - "~>"
111
+ - !ruby/object:Gem::Version
112
+ version: '1.5'
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: 1.5.33
96
116
  description:
97
117
  email: james@r0bertson.co.uk
98
118
  executables: []
@@ -120,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
140
  version: '0'
121
141
  requirements: []
122
142
  rubyforge_project:
123
- rubygems_version: 2.4.6
143
+ rubygems_version: 2.4.8
124
144
  signing_key:
125
145
  specification_version: 4
126
146
  summary: testdata
metadata.gz.sig CHANGED
Binary file