tdoc 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/tdoc.rb +2 -3
  2. data/rdoc/example.rdoc +10 -0
  3. metadata +2 -1
data/bin/tdoc.rb CHANGED
@@ -11,7 +11,6 @@ EXTENSIONS={:tests => '.rdoc',:requires => '.rb'}
11
11
  DEFAULT_FILE="README#{EXTENSIONS[:tests]}"
12
12
 
13
13
  def process(files=nil) #called at end of script
14
- files||=ARGV.shift if ARGV
15
14
  files||=DEFAULT_FILE
16
15
  if files.class==Array
17
16
  files.each {|f|`#{$PROGRAM_NAME} #{f}`}
@@ -43,7 +42,7 @@ def mk_test_context(file, test_case=nil)
43
42
  opts[:test_cases].delete_if {|c| c.match(/#{test_name}/)}
44
43
  opts[:setup]=text.match(/#{LINSTM}setup\s+(.*?)#{LINSTM}end\s+/m).to_a[1]
45
44
  tests=text.split(/#{LINST}[Ee]xamples?:/).to_a[1..-1].to_a.map do |test|
46
- test.gsub!(/#{LINST}>>\s*(.+)\n#{LINST}=>\s*(.+)/) {|m| "assert_equal #{$1}, #{$2}"}
45
+ test.gsub!(/#{LINST}>>\s*(.+)\n#{LINST}=>\s*(.+)/) {|m| "assert_equal #{$2}, #{$1}"}
47
46
  lines=test.split(/\n/)
48
47
  test_text=lines.map {|l| l.match(/#{LINST}(assert.+)/) && $1}.compact.join ";\n"
49
48
  [lines[0], test_text]
@@ -61,4 +60,4 @@ def mk_test_context(file, test_case=nil)
61
60
  opts[:contexts].compact.each {|c| mk_test_context "#{c}", test_case}
62
61
  opts[:test_cases].each {|c| process(c)}
63
62
  end
64
- process
63
+ process(ARGV.shift)
data/rdoc/example.rdoc ADDED
@@ -0,0 +1,10 @@
1
+
2
+ examples: simple irb with 1 assertion
3
+
4
+ >> "asdf"
5
+ => "asdf"
6
+ >> x="foo"
7
+ => "foo"
8
+ >> x
9
+ => "foo"
10
+ assert_raise ZeroDivisionError do; 1/0 ;end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Herb Daily
@@ -33,6 +33,7 @@ extra_rdoc_files: []
33
33
  files:
34
34
  - README.rdoc
35
35
  - bin/tdoc.rb
36
+ - rdoc/example.rdoc
36
37
  has_rdoc: true
37
38
  homepage: http://github.com/herbdaily/tdoc
38
39
  licenses: []