tdoc 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/tdoc.rb +5 -4
- metadata +1 -1
data/bin/tdoc.rb
CHANGED
@@ -32,9 +32,9 @@ def mk_test_context(file, test_case=nil)
|
|
32
32
|
opts={
|
33
33
|
:requires => Dir.glob("#{test_dir}/#{test_name}#{EXTENSIONS[:requires]}"),
|
34
34
|
:contexts => Dir.glob("#{test_dir}/#{test_name}/*#{EXTENSIONS[:tests]}"),
|
35
|
-
:
|
35
|
+
:tests => [],
|
36
36
|
}
|
37
|
-
[:requires, :
|
37
|
+
[:requires, :tests].each do |opt|
|
38
38
|
text.scan(/#{LINST}:include:\s*(.+#{EXTENSIONS[opt]})/).each do |files|
|
39
39
|
files[0].split(',').each do |f|
|
40
40
|
opts[opt] << f unless f.match(/^blob/)
|
@@ -42,7 +42,7 @@ def mk_test_context(file, test_case=nil)
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
opts[:requires].each {|r| require "#{r}" if FileTest.exist? "#{r}" }
|
45
|
-
opts[:
|
45
|
+
opts[:tests].delete_if {|c| c.match(/#{test_name}/)}
|
46
46
|
setup_text=text.match(/#{LINSTM}setup\s+(.*?)#{LINSTM}end\s+/m).to_a[1]
|
47
47
|
tests=text.split(/#{LINST}[Ee]xamples?:/).to_a[1..-1].to_a.map do |test|
|
48
48
|
test.gsub!(/#{LINST}>>\s*(.+)\n#{LINST}=>\s*(.+)/) {|m|
|
@@ -76,10 +76,11 @@ def mk_test_context(file, test_case=nil)
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
}
|
79
|
-
opts[:test_cases].each {|c| process(c)}
|
80
79
|
if test_case
|
81
80
|
test_case.module_eval {mk_test_context(file).call}
|
81
|
+
opts[:tests].each {|c| process(c)}
|
82
82
|
else
|
83
|
+
opts[:tests].each {|c| process(c)}
|
83
84
|
context_proc
|
84
85
|
end
|
85
86
|
end
|