testkit123 0.2.4 → 0.2.5
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 +0 -0
- data/lib/testkit123.rb +34 -5
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b69d7193e9f8255f026689f71a93794fa710adf05c2cce1992a1003d92a8886
|
4
|
+
data.tar.gz: 1386ccfd90a285cba41135fe003846d43ab1cb894e4856c2e5d481f245dc2c02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b9aa7567633aaf7104624da65dea865d4ed10a5936c1f824c474e8dd8e5e8b596673cd75e8947ed0fada4904bb505215f65a5af8979b15b2001e561da3bb12a
|
7
|
+
data.tar.gz: f95045d7b9381c9b8fa6b96fd17e3eb511c8e1bcda6414e385c876e999b24821865e6701be264954d02caa8d630c8f4dc5ee5abe00e69c65f4470bcc9f472dfb
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/testkit123.rb
CHANGED
@@ -135,12 +135,14 @@ end
|
|
135
135
|
ext = config[:testdata_ext][/\.?td$/] ? 'td' : 'xml'
|
136
136
|
testdata_file = File.join(datafilepath, "testdata_#{proj}.#{ext}")
|
137
137
|
puts 'testdata_file: ' + testdata_file.inspect if @debug
|
138
|
+
puts 'source code filepath: ' + test_rbfile.inspect if @debug
|
138
139
|
|
139
140
|
s = File.read(test_rbfile).gsub(/^( )?end/,'')
|
140
141
|
require_gems = s.scan(/^require +['"]([^'"]+)/).map(&:first)
|
141
142
|
|
142
|
-
before_test = s[/(?<=def tests\(\))
|
143
|
-
|
143
|
+
before_test = s[/(?<=def tests\(\)).*/m].split(/ test /)[0].lstrip
|
144
|
+
puts '** before_test: ' + before_test.inspect
|
145
|
+
|
144
146
|
a = s.split(/(?= test )/)
|
145
147
|
a.shift
|
146
148
|
|
@@ -162,13 +164,36 @@ end
|
|
162
164
|
puts 'xml: ' + xml.inspect if @debug
|
163
165
|
|
164
166
|
doc = Rexle.new(xml)
|
165
|
-
|
167
|
+
puts 'after doc : ' if @debug
|
168
|
+
r = doc.root.xpath('records//test') || doc.root.xpath('records/test')
|
169
|
+
|
170
|
+
if @debug then
|
171
|
+
puts 'r: ' + r.inspect
|
172
|
+
puts 'r.length: ' + r.length.inspect
|
173
|
+
puts 'n: ' + n.inspect
|
174
|
+
end
|
175
|
+
|
176
|
+
testnode = r[n-1]
|
177
|
+
puts 'testnode: ' + testnode.xml.inspect if @debug
|
178
|
+
|
166
179
|
title = testnode.text('summary/type')
|
167
180
|
i = tests.index tests.assoc(title)
|
168
|
-
|
181
|
+
|
169
182
|
testcode = a[i].strip.lines[1..-2].map do |line|
|
170
183
|
line.sub(/^ {6}/,'')
|
171
184
|
end.join
|
185
|
+
|
186
|
+
# replace the input variable names with the input variable names defined
|
187
|
+
# in the testdata file and prefix them with *test_*.
|
188
|
+
|
189
|
+
input_vars = testnode.xpath('records/input/summary/*/name()')
|
190
|
+
|
191
|
+
puts 'input_vars: ' + input_vars.inspect
|
192
|
+
puts 'tests[i][1]: ' + tests[i][1].inspect
|
193
|
+
puts 'zip: ' + tests[i][1].zip(input_vars).inspect
|
194
|
+
tests[i][1].zip(input_vars).each do |x|
|
195
|
+
testcode.gsub!(x[0], 'test_' + x[1])
|
196
|
+
end
|
172
197
|
|
173
198
|
args = testnode.xpath('records/input/summary/*').map do |input|
|
174
199
|
"test_%s =<<EOF\n%s\nEOF\n" % [input.name,
|
@@ -185,12 +210,15 @@ end
|
|
185
210
|
|
186
211
|
puts 'gems: ' + require_gems.inspect if @debug
|
187
212
|
|
213
|
+
codex = testcode.rstrip.lines
|
214
|
+
|
188
215
|
"# Test %d. Type: %s\n# Description: %s\n" \
|
189
216
|
% [n, title, testnode.text('summary/type')] + \
|
190
217
|
"# --------------------------------------------\n\n" + \
|
191
218
|
"require '#{proj}'\n" + require_gems.map {|x| "require '%s'" \
|
192
219
|
% x}.join("\n") + "\n\n\n" \
|
193
|
-
+ before_test.gsub(/^ /,'') + "\n" + args.join("\n")
|
220
|
+
+ before_test.gsub(/^ /,'') + "\n" + args.join("\n") \
|
221
|
+
+ codex[0..-2].join + 'puts ' + codex.last
|
194
222
|
|
195
223
|
end
|
196
224
|
|
@@ -290,3 +318,4 @@ EOF
|
|
290
318
|
end
|
291
319
|
|
292
320
|
end
|
321
|
+
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|