atp 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7cdbd30f66efb6b3795073de37ccdf0623377b7b
4
- data.tar.gz: 4b3deec7a4e80eaa56dfd1b14934790a044ab611
3
+ metadata.gz: 1cae637faa5b243ed37ff8255c7964bc7a02d82a
4
+ data.tar.gz: 8144fe3263ea7b626c7097156a9014783ceecac3
5
5
  SHA512:
6
- metadata.gz: 5309d2a1ddef3772ae949e47d3ce750a3eee0236498741cc0d752e3a7973fca9a016186ff17c02d54095055af51676b03eb2af8d6a23ebf695d7273096b5a406
7
- data.tar.gz: b391e87fa09e223a717b6f11842ca2af604b33849ade223a657f8acaa5202dc90153070a89c4117b6a99fdb8e36bfa2dbef633b22957032c274aba6332eeffae
6
+ metadata.gz: 40be54c02cb2b5359587c251ca16efe61fc33b79cf58465919af30aa871fff53f012c801a0317505e35bebdda18cce45b5f2382c272a9826024eb3cbc7e68524
7
+ data.tar.gz: 60cede7df8662ae64bcff7c46458ab9326b9e500caf2f496fd2ab15bdc79c41ce5ea2f78fe8c89e7b8ac1ea30116d2dcf8def6bc45354a4a60c7e6969955d22f
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module ATP
2
2
  MAJOR = 0
3
3
  MINOR = 3
4
- BUGFIX = 0
4
+ BUGFIX = 1
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
data/lib/atp.rb CHANGED
@@ -27,6 +27,7 @@ module ATP
27
27
  autoload :PostCleaner, 'atp/processors/post_cleaner'
28
28
  autoload :Marshal, 'atp/processors/marshal'
29
29
  autoload :AddIDs, 'atp/processors/add_ids'
30
+ autoload :FlowID, 'atp/processors/flow_id'
30
31
  end
31
32
 
32
33
  # Summarizers extract summary data from the given AST
@@ -4,7 +4,7 @@ module ATP
4
4
  include Factories
5
5
 
6
6
  attr_reader :context
7
- attr_accessor :source_file, :source_line_number
7
+ attr_accessor :source_file, :source_line_number, :description
8
8
 
9
9
  def flow
10
10
  n0(:flow)
@@ -27,10 +27,6 @@ module ATP
27
27
  n(:render, str.to_s)
28
28
  end
29
29
 
30
- def description(str)
31
- n(:description, str.to_s)
32
- end
33
-
34
30
  def id(symbol)
35
31
  n(:id, symbol.to_sym)
36
32
  end
@@ -184,8 +180,6 @@ module ATP
184
180
  if n = (options[:number] || options[:num] || options[:tnum] || options[:test_number])
185
181
  children << number(n)
186
182
  end
187
- d = options[:description] || options[:desc]
188
- children << description(d) if d
189
183
  children << id(options[:id].to_s.downcase.to_sym) if options[:id]
190
184
 
191
185
  children << on_fail(options[:on_fail]) if options[:on_fail]
@@ -203,7 +197,7 @@ module ATP
203
197
  def on_fail(options = {})
204
198
  children = []
205
199
  if options[:bin] || options[:softbin]
206
- children << set_result(:fail, bin: options[:bin], softbin: options[:softbin], description: options[:bin_description])
200
+ children << set_result(:fail, bin: options[:bin], softbin: options[:softbin], bin_description: options[:bin_description])
207
201
  end
208
202
  children << continue if options[:continue]
209
203
  n(:on_fail, *children)
@@ -212,7 +206,7 @@ module ATP
212
206
  def on_pass(options = {})
213
207
  children = []
214
208
  if options[:bin] || options[:softbin]
215
- children << set_result(:pass, bin: options[:bin], softbin: options[:softbin], description: options[:bin_description])
209
+ children << set_result(:pass, bin: options[:bin], softbin: options[:softbin], bin_description: options[:bin_description])
216
210
  end
217
211
  children << continue if options[:continue]
218
212
  n(:on_pass, *children)
@@ -223,7 +217,7 @@ module ATP
223
217
  children << type
224
218
  children << n(:bin, options[:bin]) if options[:bin]
225
219
  children << n(:softbin, options[:softbin]) if options[:softbin]
226
- children << n(:description, options[:description]) if options[:description]
220
+ children << n(:bin_description, options[:bin_description]) if options[:bin_description]
227
221
  result = n(:set_result, *children)
228
222
 
229
223
  if options[:conditions]
@@ -5,6 +5,7 @@ module ATP
5
5
  options = children.last.is_a?(Hash) ? children.pop : {}
6
6
  options[:file] ||= options.delete(:source_file) || try(:source_file)
7
7
  options[:line_number] ||= options.delete(:source_line_number) || try(:source_line_number)
8
+ options[:description] ||= options.delete(:description) || try(:description)
8
9
  ATP::AST::Node.new(type, children, options)
9
10
  end
10
11
 
data/lib/atp/flow.rb CHANGED
@@ -5,6 +5,7 @@ module ATP
5
5
  attr_reader :program, :name
6
6
  # Returns the raw AST
7
7
  attr_reader :raw
8
+ attr_accessor :id
8
9
 
9
10
  def initialize(program, name = nil)
10
11
  @program = program
@@ -26,6 +27,9 @@ module ATP
26
27
  # used to build and represent the given test flow
27
28
  def ast
28
29
  ast = Processors::PreCleaner.new.process(raw)
30
+ # File.open("a1.txt", "w") { |f| f.write(ast) }
31
+ ast = Processors::FlowID.new.run(ast, id) if id
32
+ # File.open("a2.txt", "w") { |f| f.write(ast) }
29
33
  Validators::DuplicateIDs.new(self).process(ast)
30
34
  Validators::MissingIDs.new(self).process(ast)
31
35
  ast = Processors::Condition.new.process(ast)
@@ -258,6 +262,7 @@ module ATP
258
262
  def extract_meta!(options)
259
263
  builder.source_file = options.delete(:source_file) if options[:source_file]
260
264
  builder.source_line_number = options.delete(:source_line_number) if options[:source_line_number]
265
+ builder.description = options.delete(:description) if options[:description]
261
266
  end
262
267
 
263
268
  # For testing
@@ -0,0 +1,28 @@
1
+ module ATP
2
+ module Processors
3
+ # Adds the flow ID to all ids and label names
4
+ class FlowID < Processor
5
+ attr_reader :id
6
+
7
+ def run(node, id)
8
+ @id = id
9
+ process(node)
10
+ end
11
+
12
+ def on_id(node)
13
+ node.updated(nil, ["#{node.value}_#{id}"])
14
+ end
15
+
16
+ def on_test_result(node)
17
+ tid, state, nodes = *node
18
+ if tid.is_a?(Array)
19
+ tid = tid.map { |tid| "#{tid}_#{id}" }
20
+ else
21
+ tid = "#{tid}_#{id}"
22
+ end
23
+ node.updated(nil, [tid, state] + [process(nodes)])
24
+ end
25
+ alias_method :on_test_executed, :on_test_result
26
+ end
27
+ end
28
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-03 00:00:00.000000000 Z
11
+ date: 2016-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen
@@ -77,6 +77,7 @@ files:
77
77
  - lib/atp/processors/add_ids.rb
78
78
  - lib/atp/processors/condition.rb
79
79
  - lib/atp/processors/condition_extractor.rb
80
+ - lib/atp/processors/flow_id.rb
80
81
  - lib/atp/processors/marshal.rb
81
82
  - lib/atp/processors/post_cleaner.rb
82
83
  - lib/atp/processors/pre_cleaner.rb