testdata 0.3.2 → 0.3.3

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 +17 -10
  2. metadata +2 -2
data/lib/testdata.rb CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  # file: testdata.rb
4
4
 
5
- require 'builder'
5
+ require 'rexle'
6
+ require 'rexle-builder'
6
7
  require 'rexml/document'
7
8
 
8
9
  class Path
@@ -57,8 +58,9 @@ class Path
57
58
  result = [raw_result].compact == expected
58
59
  end
59
60
 
60
- rescue
61
- err_label = 'error: ' + ($!).to_s
61
+ rescue Exception => e
62
+ err_label = e.message + " :: \n" + e.backtrace.join("\n")
63
+
62
64
  puts err_label
63
65
  XPath.first(node_result, "error").text = err_label
64
66
  result = false
@@ -116,9 +118,15 @@ class Testdata
116
118
  private
117
119
 
118
120
  def tests()
119
- script = XPath.first(@doc.root, "summary/script/text()").to_s
120
- file_path = File.exists?(script) ? script : @filepath + '/' + script
121
- s = File.open(file_path,'r').read
121
+ script_file = XPath.first(@doc.root, "summary/script/text()").to_s
122
+
123
+ if script_file[/\/\/job:/] then
124
+ s = Rscript.new.read script_file.split(/\s/)
125
+ else
126
+
127
+ file_path = File.exists?(script_file) ? script : @filepath + '/' + script_file
128
+ s = File.open(file_path,'r').read
129
+ end
122
130
 
123
131
  stringify = Proc.new {|x| x.text.to_s.gsub(/[\n\s]/,'').length > 0 ? x.text : x.cdatas.join.strip}
124
132
 
@@ -159,10 +167,9 @@ class Testdata
159
167
 
160
168
  def tests_to_dynarex(tests)
161
169
 
162
- xml = Builder::XmlMarkup.new( target: buffer='', indent: 2 )
163
- xml.instruct! :xml, version: "1.0", encoding: "UTF-8"
170
+ xml = RexleBuilder.new
164
171
 
165
- xml.results do
172
+ a = xml.results do
166
173
  xml.summary do
167
174
  xml.recordx_type 'dynarex'
168
175
  xml.format_mask '[!path_no] [!title] [!test] [!expected] [!actual]'
@@ -198,7 +205,7 @@ class Testdata
198
205
  end
199
206
  end
200
207
 
201
- buffer
208
+ Rexle.new(a).xml pretty: true
202
209
  end
203
210
 
204
211
  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.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors: []
7
7
 
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2011-01-27 00:00:00 +00:00
12
+ date: 2011-02-23 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency