atp 0.8.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,17 +0,0 @@
1
- module ATP
2
- module AST
3
- module Factories
4
- def n(type, *children)
5
- options = children.last.is_a?(Hash) ? children.pop : {}
6
- options[:file] ||= options.delete(:source_file) || try(:source_file)
7
- options[:line_number] ||= options.delete(:source_line_number) || try(:source_line_number)
8
- options[:description] ||= options.delete(:description) || try(:description)
9
- ATP::AST::Node.new(type, children, options)
10
- end
11
-
12
- def n0(type, options = {})
13
- n(type, options)
14
- end
15
- end
16
- end
17
- end
@@ -1,43 +0,0 @@
1
- module ATP
2
- module Processors
3
- # Runs at the very end of a processor run, to do some final cleanup,
4
- # e.g. to assign generated IDs to tests that don't have one
5
- class PostCleaner < Processor
6
- # Returns a hash containing the IDs of all tests that have
7
- # been used
8
- attr_reader :ids
9
-
10
- # Extracts all ID values of tests within the given AST
11
- class ExtractTestIDs < Processor
12
- attr_reader :results
13
-
14
- def on_test(node)
15
- id = node.children.find { |n| n.type == :id }
16
- if id
17
- @results ||= {}
18
- @results[id] = true
19
- end
20
- end
21
- end
22
-
23
- def process(node)
24
- # On first call extract the test_result nodes from the given AST,
25
- # then process as normal thereafter
26
- if @first_call_done
27
- result = super
28
- else
29
- @first_call_done = true
30
- t = ExtractTestIDs.new
31
- t.process(node)
32
- @ids = t.results || {}
33
- result = super
34
- @first_call_done = false
35
- end
36
- result
37
- end
38
-
39
- def on_test(node)
40
- end
41
- end
42
- end
43
- end