testkit123 0.1.1 → 0.2.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: 450ccc9a442f2658473064888bce01da57694917
4
- data.tar.gz: 623373ce095ff80479de0753b41063b620acf14a
3
+ metadata.gz: 2563eb57a18c89ef468c4030d4b40e263a33d376
4
+ data.tar.gz: 9b4c256c3215efc77b46dbb23d0e7379c6771599
5
5
  SHA512:
6
- metadata.gz: 1f27894055722acc4c70ffaf98ec8327a1d2488b0bfb2ed399f263537d2a38f6df69a24dead85e1d215b6f589318e5a13e0e37d102d4c0422407d23c6ffcf36e
7
- data.tar.gz: d13346dffa9c6969d547228db994b42505aadd4398366066021d5ebd6be8b0e53c023b92aaf6368df5b5b6c8ece1f28dfcbf6b34028434ef13a7fb080fb75b2f
6
+ metadata.gz: 35f3491218b52988ee2a2e5642ec4924bf3a4b79328c385d5e592f38fb089ecd97613dbf1c80b7024ecf405fc29bb132fd0f2d5ca0c7336e00f2707cfbfa775a
7
+ data.tar.gz: 2e764f3c0e72bf783aff0609f9e26f7c7347df967cbbdea598ed4c1bc8ae7e1356ec0e94e082dddc5a13f9ff0f5cf73d00233e1d9f7168bfc0baa167267befeb
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- ����:wz�������v rI�s�k�ٯ�"��F���u�Q`�u���N�
2
- O ��ˈ#�C8�/�s������/���Ȥ��j%��$7.���ɢz y�tOÜ��5M����_���U�W*��@Lu�+��/yX�f$�7���IΔ(��׿ �E���
3
1
  K
2
+ e4j��4'�A��n���T�����Qu��>g+�[FDr�hEB�+���S�\�x�w^ ?YSo�
3
+ ����)f
data/lib/testkit123.rb CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  require 'rxfhelper'
6
6
  require 'fileutils'
7
+ require 'testdata_text'
7
8
  require 'simple-config'
8
9
 
9
10
 
@@ -16,7 +17,7 @@ end
16
17
  class TestKit123
17
18
 
18
19
  def initialize(templates: {testdata: nil, testx: nil}, project: nil,
19
- testdata: nil, debug: false, localpath: nil, datapath: nil,
20
+ debug: false, localpath: nil, datapath: nil,
20
21
  gemtest_url: nil, rubyver: 'ruby-2.5.1')
21
22
 
22
23
  @h = templates
@@ -27,7 +28,7 @@ class TestKit123
27
28
  File.join(localpath, project + '.txt')
28
29
  end
29
30
 
30
- @testdata, @debug = testdata, debug
31
+ @debug = debug
31
32
  @localpath, @datapath, @gemtest_url = localpath, datapath, gemtest_url
32
33
  @rubyver = rubyver
33
34
 
@@ -112,7 +113,58 @@ end
112
113
  "finished processing #{proj}"
113
114
  end
114
115
 
115
- def create_standalone()
116
+ def create_standalone(n)
117
+
118
+ # use the test number to find the test to copy from the test file
119
+
120
+ config = SimpleConfig.new(@project_config).to_h
121
+
122
+ proj = config[:project]
123
+ datafilepath = config[:data_path] + '/' + proj
124
+ test_rbfile = File.join(datafilepath, "test_#{proj}.rb")
125
+
126
+ ext = config[:testdata_ext][/\.?td$/] ? 'td' : 'xml'
127
+ testdata_file = File.join(datafilepath, "testdata_#{proj}.#{ext}")
128
+ puts 'testdata_file: ' + testdata_file.inspect if @debug
129
+
130
+ s = File.read test_rbfile
131
+ a = s.split(/(?= test )/)
132
+ a.shift
133
+
134
+ tests = a.map do |x|
135
+ r = a[0].match(/(?<=['"])(?<test>[^"']+)['"]\s+do\s+\|(?<raw_args>[^\|]+)/)
136
+
137
+ [r[:test], r[:raw_args].split(/, */)]
138
+ end
139
+
140
+ s2 , filetype = RXFHelper.read testdata_file
141
+ puts 'filetype: ' + filetype.inspect if @debug
142
+
143
+ xml = if s2.lstrip[0] == '<' then
144
+ s2
145
+ else
146
+ TestdataText.parse s2
147
+ end
148
+
149
+ puts 'xml: ' + xml.inspect if @debug
150
+
151
+ doc = Rexle.new(xml)
152
+ testnode = doc.root.xpath('records//test')[n-1]
153
+ title = testnode.text('summary/type')
154
+ i = tests.index tests.assoc(title)
155
+
156
+ testcode = a[i].strip.lines[1..-2].map do |line|
157
+ line.sub(/^ {6}/,'')
158
+ end
159
+
160
+ args = testnode.xpath('records/input/summary/*').map do |input|
161
+ "%s = '%s'" % [input.name, input.texts.join.gsub(/'/,"\'")]
162
+ end
163
+
164
+ puts 'args: ' + args.inspect if @debug
165
+
166
+ "require '#{proj}'\n\n" + args.join("\n") + testcode.join
167
+
116
168
  end
117
169
 
118
170
  def delete_files(s=nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testkit123
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -72,6 +72,26 @@ dependencies:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: 0.6.4
75
+ - !ruby/object:Gem::Dependency
76
+ name: testdata_text
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '0.2'
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: 0.2.2
85
+ type: :runtime
86
+ prerelease: false
87
+ version_requirements: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '0.2'
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 0.2.2
75
95
  description:
76
96
  email: james@jamesrobertson.eu
77
97
  executables: []
metadata.gz.sig CHANGED
Binary file