rubydoctest 0.2.1 → 1.0.0
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.
- data/History.txt +10 -0
- data/License.txt +16 -17
- data/Manifest.txt +13 -5
- data/PostInstall.txt +2 -3
- data/README.txt +48 -57
- data/Ruby DocTest.tmproj +197 -0
- data/bin/rubydoctest +41 -25
- data/config/hoe.rb +3 -5
- data/lib/code_block.rb +68 -0
- data/lib/doctest_require.rb +3 -0
- data/lib/lines.rb +143 -0
- data/lib/result.rb +63 -0
- data/lib/rubydoctest.rb +13 -255
- data/lib/rubydoctest/version.rb +3 -3
- data/lib/runner.rb +370 -0
- data/lib/special_directive.rb +44 -0
- data/lib/statement.rb +75 -0
- data/lib/test.rb +29 -0
- data/rubydoctest.gemspec +6 -6
- data/script/console +0 -0
- data/script/destroy +0 -0
- data/script/generate +0 -0
- data/script/rstakeout +92 -0
- data/script/txt2html +0 -0
- data/tasks/doctests.rake +2 -1
- data/textmate/DocTest (Markdown).textmate +7 -0
- data/textmate/DocTest (Ruby).textmate +55 -0
- data/textmate/DocTest (Text).textmate +66 -0
- data/website/index.html +141 -11
- data/website/template.html.erb +1 -1
- metadata +22 -15
- data/test/doctest/file_relative.doctest +0 -5
- data/test/doctest/runner.doctest +0 -58
- data/test/doctest/simple.doctest +0 -30
- data/test/test_helper.rb +0 -2
- data/test/test_rubydoctest.rb +0 -11
data/website/template.html.erb
CHANGED
@@ -37,7 +37,7 @@
|
|
37
37
|
</div>
|
38
38
|
<%= body %>
|
39
39
|
<p class="coda">
|
40
|
-
<a href="
|
40
|
+
<a href="mailto:duane.johnson@gmail.com">Duane Johnson</a>, <%= modified.pretty %><br>
|
41
41
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
42
42
|
</p>
|
43
43
|
</div>
|
metadata
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubydoctest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Duane Johnson
|
7
8
|
- Tom Locke
|
8
9
|
- Dr Nic Williams
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
13
|
|
13
|
-
date: 2008-
|
14
|
+
date: 2008-06-23 00:00:00 -06:00
|
14
15
|
default_executable:
|
15
16
|
dependencies: []
|
16
17
|
|
17
18
|
description: Ruby version of Python's doctest tool, but a bit different.
|
18
|
-
email:
|
19
|
+
email: duane.johnson@gmail.com
|
19
20
|
executables:
|
20
21
|
- rubydoctest
|
21
22
|
extensions: []
|
@@ -34,26 +35,34 @@ files:
|
|
34
35
|
- PostInstall.txt
|
35
36
|
- README.txt
|
36
37
|
- Rakefile
|
38
|
+
- Ruby DocTest.tmproj
|
37
39
|
- bin/rubydoctest
|
38
40
|
- config/hoe.rb
|
39
41
|
- config/requirements.rb
|
42
|
+
- lib/code_block.rb
|
43
|
+
- lib/doctest_require.rb
|
44
|
+
- lib/lines.rb
|
45
|
+
- lib/result.rb
|
40
46
|
- lib/rubydoctest.rb
|
41
47
|
- lib/rubydoctest/version.rb
|
48
|
+
- lib/runner.rb
|
49
|
+
- lib/special_directive.rb
|
50
|
+
- lib/statement.rb
|
51
|
+
- lib/test.rb
|
42
52
|
- rubydoctest.gemspec
|
43
53
|
- script/console
|
44
54
|
- script/destroy
|
45
55
|
- script/generate
|
56
|
+
- script/rstakeout
|
46
57
|
- script/txt2html
|
47
58
|
- setup.rb
|
48
59
|
- tasks/deployment.rake
|
49
60
|
- tasks/doctests.rake
|
50
61
|
- tasks/environment.rake
|
51
62
|
- tasks/website.rake
|
52
|
-
-
|
53
|
-
-
|
54
|
-
-
|
55
|
-
- test/test_helper.rb
|
56
|
-
- test/test_rubydoctest.rb
|
63
|
+
- textmate/DocTest (Markdown).textmate
|
64
|
+
- textmate/DocTest (Ruby).textmate
|
65
|
+
- textmate/DocTest (Text).textmate
|
57
66
|
- website/index.html
|
58
67
|
- website/index.txt
|
59
68
|
- website/javascripts/rounded_corners_lite.inc.js
|
@@ -63,10 +72,9 @@ has_rdoc: true
|
|
63
72
|
homepage: http://rubydoctest.rubyforge.org
|
64
73
|
post_install_message: |+
|
65
74
|
|
66
|
-
rubydoctest comes as an executable that takes a
|
75
|
+
rubydoctest comes as an executable that takes a list of files:
|
67
76
|
|
68
|
-
rubydoctest
|
69
|
-
rubydoctest some/path/to/tests
|
77
|
+
rubydoctest lib/*.rb
|
70
78
|
rubydoctest simple.doctest
|
71
79
|
|
72
80
|
|
@@ -90,10 +98,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
98
|
requirements: []
|
91
99
|
|
92
100
|
rubyforge_project: rubydoctest
|
93
|
-
rubygems_version: 1.
|
101
|
+
rubygems_version: 1.0.1
|
94
102
|
signing_key:
|
95
103
|
specification_version: 2
|
96
104
|
summary: Ruby version of Python's doctest tool, but a bit different.
|
97
|
-
test_files:
|
98
|
-
|
99
|
-
- test/test_rubydoctest.rb
|
105
|
+
test_files: []
|
106
|
+
|
data/test/doctest/runner.doctest
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
Underpinning the RubyDocTest framework is a RubyDocTest::Runner instance.
|
2
|
-
|
3
|
-
>> require File.dirname(__FILE__) + "/../../lib/rubydoctest"
|
4
|
-
|
5
|
-
The Runner parses the contents of *.doctest files under test, specifically it is
|
6
|
-
passed a String, in RubyDocTest format (a superset of Markdown format), runs
|
7
|
-
the inline Ruby code and compares it to any "=> expected" results.
|
8
|
-
|
9
|
-
The aggregated results are returned for inspection and display to the user.
|
10
|
-
|
11
|
-
The base case is to evaluate an empty string which should not fail.
|
12
|
-
|
13
|
-
>> runner = RubyDocTest.new("", __FILE__)
|
14
|
-
>> runner.run_file
|
15
|
-
|
16
|
-
You should also be able to evaluate any Markdown document without failure.
|
17
|
-
|
18
|
-
>>
|
19
|
-
runner = RubyDocTest.new(<<-MARKDOWN, __FILE__)
|
20
|
-
This is a markdown document.
|
21
|
-
|
22
|
-
class Person
|
23
|
-
end
|
24
|
-
|
25
|
-
No special DocTest code in this document
|
26
|
-
MARKDOWN
|
27
|
-
>> runner.run_file
|
28
|
-
=> true
|
29
|
-
|
30
|
-
The excitement starts when the document under test includes `>>` sections
|
31
|
-
containing Ruby code:
|
32
|
-
|
33
|
-
>>
|
34
|
-
runner = RubyDocTest.new(<<-MARKDOWN, __FILE__)
|
35
|
-
This is a doctest document.
|
36
|
-
|
37
|
-
>> class Dog; end
|
38
|
-
>> dog = Dog.new
|
39
|
-
>> dog.class
|
40
|
-
=> Dog
|
41
|
-
|
42
|
-
The above contains several expression, and one test: `dog.class == Dog`
|
43
|
-
MARKDOWN
|
44
|
-
>> runner.run_file
|
45
|
-
=> true
|
46
|
-
|
47
|
-
You can also include code and tests that currently fail:
|
48
|
-
|
49
|
-
>>
|
50
|
-
runner = RubyDocTest.new(<<-MARKDOWN, __FILE__)
|
51
|
-
Watch out for bad maths:
|
52
|
-
|
53
|
-
>> 1 + 1
|
54
|
-
=> 3
|
55
|
-
|
56
|
-
MARKDOWN
|
57
|
-
>> runner.run_file
|
58
|
-
=> false
|
data/test/doctest/simple.doctest
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# Simple test of RubyDocTest
|
2
|
-
|
3
|
-
This is an example test
|
4
|
-
|
5
|
-
>> 1 + 2
|
6
|
-
=> 3
|
7
|
-
|
8
|
-
Test a some multiline statements
|
9
|
-
|
10
|
-
>>
|
11
|
-
class Person
|
12
|
-
attr_accessor :name
|
13
|
-
end
|
14
|
-
|
15
|
-
>> Person
|
16
|
-
=> Person
|
17
|
-
>> p = Person.new
|
18
|
-
>> p.name = "Tom"
|
19
|
-
>> p.name
|
20
|
-
=> "Tom"
|
21
|
-
|
22
|
-
|
23
|
-
>> "a
|
24
|
-
b"
|
25
|
-
=> "a\nb"
|
26
|
-
|
27
|
-
>> 1 +
|
28
|
-
?> 2
|
29
|
-
=> 3
|
30
|
-
|
data/test/test_helper.rb
DELETED