qed 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{LICENSE → COPYING} +2 -2
- data/MANIFEST +2 -16
- data/README.rdoc +58 -21
- data/bin/qed +13 -13
- data/demo/01_spec.qed +6 -3
- data/doc/qedoc/index.html +13 -10
- data/lib/qed.rb +4 -3
- data/lib/qed/document.rb +9 -10
- data/lib/qed/{utilities/extract.rb → extract.rb} +0 -0
- data/lib/qed/script.rb +7 -1
- data/meta/requires +2 -0
- data/meta/version +1 -1
- metadata +25 -15
- data/lib/qed/assertion.rb +0 -23
- data/lib/qed/doubles/mock.rb +0 -94
- data/lib/qed/doubles/spy.rb +0 -191
- data/lib/qed/doubles/stub.rb +0 -94
- data/lib/qed/expectation.rb +0 -60
- data/lib/qed/grammar/assert.rb +0 -104
- data/lib/qed/grammar/expect.rb +0 -121
- data/lib/qed/grammar/legacy/assert.rb +0 -291
- data/lib/qed/grammar/should.rb +0 -52
- data/lib/qed/utilities/monitor.rb +0 -23
data/{LICENSE → COPYING}
RENAMED
data/MANIFEST
CHANGED
@@ -11,23 +11,12 @@ doc/qedoc/index.html
|
|
11
11
|
doc/qedoc/jquery.js
|
12
12
|
lib
|
13
13
|
lib/qed
|
14
|
-
lib/qed/assertion.rb
|
15
14
|
lib/qed/document
|
16
15
|
lib/qed/document/jquery.js
|
17
16
|
lib/qed/document/markup.rb
|
18
17
|
lib/qed/document/template.rhtml
|
19
18
|
lib/qed/document.rb
|
20
|
-
lib/qed/
|
21
|
-
lib/qed/doubles/mock.rb
|
22
|
-
lib/qed/doubles/spy.rb
|
23
|
-
lib/qed/doubles/stub.rb
|
24
|
-
lib/qed/expectation.rb
|
25
|
-
lib/qed/grammar
|
26
|
-
lib/qed/grammar/assert.rb
|
27
|
-
lib/qed/grammar/expect.rb
|
28
|
-
lib/qed/grammar/legacy
|
29
|
-
lib/qed/grammar/legacy/assert.rb
|
30
|
-
lib/qed/grammar/should.rb
|
19
|
+
lib/qed/extract.rb
|
31
20
|
lib/qed/reporter
|
32
21
|
lib/qed/reporter/base.rb
|
33
22
|
lib/qed/reporter/dotprogress.rb
|
@@ -35,9 +24,6 @@ lib/qed/reporter/summary.rb
|
|
35
24
|
lib/qed/reporter/verbatim.rb
|
36
25
|
lib/qed/runner.rb
|
37
26
|
lib/qed/script.rb
|
38
|
-
lib/qed/utilities
|
39
|
-
lib/qed/utilities/extract.rb
|
40
|
-
lib/qed/utilities/monitor.rb
|
41
27
|
lib/qed.rb
|
42
28
|
meta
|
43
29
|
meta/authors
|
@@ -51,6 +37,6 @@ meta/ruby
|
|
51
37
|
meta/summary
|
52
38
|
meta/title
|
53
39
|
meta/version
|
54
|
-
LICENSE
|
55
40
|
README.rdoc
|
56
41
|
HISTORY
|
42
|
+
COPYING
|
data/README.rdoc
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= Ruby Q.E.D.
|
2
2
|
|
3
3
|
homepage: http://proutils.rubyforge.org/qed
|
4
|
-
mailing list: http://groups.google.com/group/tigerops-community
|
4
|
+
mailing list: http://groups.google.com/group/tigerops-community
|
5
5
|
development: http://github.com/proutils/qed/tree/master
|
6
6
|
|
7
7
|
|
@@ -9,16 +9,19 @@
|
|
9
9
|
|
10
10
|
Q.E.D. stands for Quality Enhanced Demos. QED is an easy to use
|
11
11
|
quality assurance and documentation system for Ruby Developers.
|
12
|
-
QED
|
13
|
-
requirements specifications like Cucumber. It is
|
14
|
-
address
|
15
|
-
useful when designing reusble libraries.
|
12
|
+
QED sits between lower-level testing tools like Test Unit and
|
13
|
+
grand requirements specifications tools like Cucumber. It is
|
14
|
+
designed to address <i>API-Driven Devleopment</i>, which
|
15
|
+
is especailly useful when designing reusble libraries.
|
16
16
|
|
17
17
|
|
18
18
|
== Features
|
19
19
|
|
20
|
-
* Demos can be RDoc or
|
21
|
-
* Uses
|
20
|
+
* Demos can be RDoc, Markdown or any other conforming text format.
|
21
|
+
* Uses excellent Assertive Expressive library for assertion system.
|
22
|
+
* Helpers are easily loaded relative to running document.
|
23
|
+
* Table macro allows large sets of data to be run by the same code.
|
24
|
+
* Documentation tool provides nice output with jQuery-based TOC.
|
22
25
|
|
23
26
|
|
24
27
|
== Synopsis
|
@@ -41,7 +44,7 @@ You can learn more about AE at http://proutils.rubyforge/ae.
|
|
41
44
|
QED documents are simply text files --thus a practice of literal programming.
|
42
45
|
For example:
|
43
46
|
|
44
|
-
|
47
|
+
= Example
|
45
48
|
|
46
49
|
Shows that the number 5 does not equal 4.
|
47
50
|
|
@@ -51,47 +54,81 @@ For example:
|
|
51
54
|
|
52
55
|
5.assert == 5
|
53
56
|
|
54
|
-
As you can see, we used
|
57
|
+
As you can see, we used RDoc for this document. Almost any text format
|
55
58
|
can be used. The only neccesary distinction is that desciption text be
|
56
59
|
align to the left margin and all code be indented. However QED recognizes
|
57
60
|
RDoc and Markdown style headers, so any format that supports this style
|
58
61
|
(which covers many markup formats in use today) will work a bit better.
|
59
62
|
While strictly speaking QED does not need to recognize headers, it does
|
60
|
-
improve console output
|
63
|
+
improve console output.
|
61
64
|
|
62
65
|
Give this design some thought. It should become clear that this approach is
|
63
66
|
especially fruitful in that it allows *documentation* and *specification*
|
64
|
-
to seemlessly merge into a unified *
|
65
|
-
|
66
|
-
If we run this document through QED in verbatim mode the output would be
|
67
|
-
identical (assuming we did not make a typo and the assertions passed).
|
68
|
-
If there were errors or failures, we would see information detaling each.
|
67
|
+
to seemlessly merge into a unified *demonstration*.
|
69
68
|
|
70
69
|
=== Running Demonstrations
|
71
70
|
|
71
|
+
If we were to run the above document through QED in verbatim mode the output
|
72
|
+
would be identical (assuming we did not make a typo and the assertions passed).
|
73
|
+
If there were errors or failures, we would see information detaling each.
|
74
|
+
|
72
75
|
To run a document through QED, simply use the +qed+ command.
|
73
76
|
|
74
|
-
$ qed demo/01_example.rdoc
|
77
|
+
$ qed -v demo/01_example.rdoc
|
78
|
+
|
79
|
+
The <tt>-v</tt> option specifies verbatim mode, which outputs the entire
|
80
|
+
document.
|
75
81
|
|
76
82
|
Notice we placed the QED document in the demo directory, this is the
|
77
|
-
|
83
|
+
concial place that has been designated for them, though you can put them
|
78
84
|
elsewhre in your project if you prefer. Also notice the 01_ in front
|
79
85
|
of the name. While this is not necessary, it helps order the documents
|
80
|
-
properly with
|
86
|
+
properly with generating QED documentation (QEDocs).
|
81
87
|
|
82
|
-
|
83
|
-
+qedoc+ command. Eg.
|
88
|
+
To generate documentation from QED documents, use the +qedoc+ command.
|
84
89
|
|
85
90
|
$ qed --output doc/qedoc --title "Example" demo/*.rdoc
|
86
91
|
|
92
|
+
When documenting QED recognizes the format by the file extension and
|
93
|
+
treats it accordingly. An extension of <tt>.qed</tt> is treated the same
|
94
|
+
as <tt>.rdoc</tt>.
|
95
|
+
|
87
96
|
Use the <tt>--help</tt> options on each command to get more inforamtion on
|
88
97
|
the use of these commands.
|
89
98
|
|
99
|
+
|
100
|
+
== Requirements
|
101
|
+
|
102
|
+
QED depends on the following external libraries:
|
103
|
+
|
104
|
+
* AE - Assertions Framework
|
105
|
+
* ANSI - ANSI Color Codes
|
106
|
+
* Facets - Core Extensions
|
107
|
+
|
108
|
+
These will be automatically installed when installing QED via RubyGems,
|
109
|
+
if they are not already installed.
|
110
|
+
|
111
|
+
|
90
112
|
== Copyright and License
|
91
113
|
|
92
114
|
Q.E.D.
|
93
115
|
|
94
116
|
Copyright (c) 2007,2009 Thomas Sawyer
|
95
117
|
|
96
|
-
QED is distributed under the
|
118
|
+
Unless otherwise permitted by the author, QED is distributed under the
|
119
|
+
terms of the GPL version 3 or greater. See COPYING file for details.
|
120
|
+
|
121
|
+
This program is free software; you can redistribute it and/or modify
|
122
|
+
it under the terms of the GNU General Public License as published by
|
123
|
+
the Free Software Foundation; either version 2 of the License, or
|
124
|
+
(at your option) any later version.
|
125
|
+
|
126
|
+
This program is distributed in the hope that it will be useful,
|
127
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
128
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
129
|
+
GNU General Public License for more details.
|
130
|
+
|
131
|
+
You should have received a copy of the GNU General Public License
|
132
|
+
along with this program; if not, write to the Free Software
|
133
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
97
134
|
|
data/bin/qed
CHANGED
@@ -64,18 +64,18 @@ module QED
|
|
64
64
|
|
65
65
|
# TODO: Better way to load helpers?
|
66
66
|
#
|
67
|
-
def load_helpers
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
end
|
67
|
+
#def load_helpers
|
68
|
+
# dirs = spec_files.map{ |file| File.join(Dir.pwd, File.dirname(file)) }
|
69
|
+
# dirs = dirs.select{ |dir| File.directory?(dir) }
|
70
|
+
# dirs.each do |dir|
|
71
|
+
# while dir != '/' do
|
72
|
+
# helper = File.join(dir, 'qed_helper.rb')
|
73
|
+
# load(helper) if File.exist?(helper)
|
74
|
+
# break if Dir.pwd == dir
|
75
|
+
# dir = File.dirname(dir)
|
76
|
+
# end
|
77
|
+
# end
|
78
|
+
#end
|
79
79
|
|
80
80
|
#
|
81
81
|
def specs
|
@@ -120,7 +120,7 @@ module QED
|
|
120
120
|
def execute
|
121
121
|
parse_options
|
122
122
|
#load_rc
|
123
|
-
load_helpers
|
123
|
+
#load_helpers
|
124
124
|
case reporter
|
125
125
|
when :script
|
126
126
|
specs.each do |spec|
|
data/demo/01_spec.qed
CHANGED
@@ -31,9 +31,8 @@ And this would have raised a NameError:
|
|
31
31
|
= Neutral Code
|
32
32
|
|
33
33
|
There is no means of specifying that a code clause is neutral code,
|
34
|
-
i.e. that it should be executed but not tested.
|
35
|
-
|
36
|
-
feature in the future if it is ultimately deemed necessary.
|
34
|
+
i.e. that it should be executed but not tested. Thus far, such a
|
35
|
+
feature has proven to be a YAGNI.
|
37
36
|
|
38
37
|
|
39
38
|
= Defining Custom Assertions
|
@@ -141,3 +140,7 @@ This concludes the basic overview of QED's specification system, which
|
|
141
140
|
is itself a QED document. Yes, we eat our own dog food.
|
142
141
|
|
143
142
|
Q.E.D.
|
143
|
+
|
144
|
+
---
|
145
|
+
require 'qed_helper'
|
146
|
+
|
data/doc/qedoc/index.html
CHANGED
@@ -109,7 +109,7 @@ executable code.
|
|
109
109
|
<p>
|
110
110
|
Each code section is executed in order of appearance, within a rescue
|
111
111
|
wrapper that captures any failures or errors. If neither a failure or error
|
112
|
-
occur then the code gets a
|
112
|
+
occur then the code gets a “pass”.
|
113
113
|
</p>
|
114
114
|
<p>
|
115
115
|
For example, the following passes:
|
@@ -118,17 +118,13 @@ For example, the following passes:
|
|
118
118
|
(2 + 2).assert == 4
|
119
119
|
</pre>
|
120
120
|
<p>
|
121
|
-
While the following would
|
122
|
-
an Assertion error:
|
121
|
+
While the following would “fail”, as indicated by the raising
|
122
|
+
of an Assertion error:
|
123
123
|
</p>
|
124
124
|
<pre>
|
125
|
-
Assertion
|
125
|
+
expect Assertion do
|
126
126
|
(2 + 2).assert == 5
|
127
127
|
end
|
128
|
-
|
129
|
-
#expect Assertion do
|
130
|
-
# (2 + 2).assert == 5
|
131
|
-
#end
|
132
128
|
</pre>
|
133
129
|
<p>
|
134
130
|
And this would have raised a NameError:
|
@@ -145,7 +141,7 @@ that it should be executed but not tested. So far this such a feature has
|
|
145
141
|
proven to be a YAGNI. Yet we may add such a feature in the future if it is
|
146
142
|
ultimately deemed necessary.
|
147
143
|
</p>
|
148
|
-
<h1>Defining
|
144
|
+
<h1>Defining Custom Assertions</h1>
|
149
145
|
<p>
|
150
146
|
The context in which the QED code is run is a self-extended module, thus
|
151
147
|
reusable macros can be created simply by defining a method.
|
@@ -169,6 +165,13 @@ Let’s prove that it can also fail:
|
|
169
165
|
assert_integer("IV")
|
170
166
|
end
|
171
167
|
</pre>
|
168
|
+
<h1>Helper File</h1>
|
169
|
+
<p>
|
170
|
+
If you create a file called `qed_helper.rb` located in the directory with
|
171
|
+
the QED documents you are running via the `qed` command, it will be loaded
|
172
|
+
first. You can use that to load optional AE features, or define your own
|
173
|
+
specialized assertion methods.
|
174
|
+
</p>
|
172
175
|
<h1>Before and After Clauses</h1>
|
173
176
|
<p>
|
174
177
|
QED supports <b>before</b> and <b>after</b> clauses in a specification
|
@@ -241,7 +244,7 @@ Finally we will demonstrate a tabular step. <tt>table</tt> method is used
|
|
241
244
|
for this. We supply a file name to the method telling QED where to find the
|
242
245
|
table data to be used in the test. All table files are looked for relative
|
243
246
|
to the location of the document. If no name is given the
|
244
|
-
’
|
247
|
+
’<doc-name>.yaml’ is assumed.
|
245
248
|
</p>
|
246
249
|
<p>
|
247
250
|
The arity of the table block determines the number of columns each row in
|
data/lib/qed.rb
CHANGED
data/lib/qed/document.rb
CHANGED
@@ -77,15 +77,14 @@ module QED
|
|
77
77
|
#strio.close
|
78
78
|
|
79
79
|
case ext = File.extname(file)
|
80
|
-
when '.qed'
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
when '.rd', '.rdoc'
|
80
|
+
#when '.qed'
|
81
|
+
# require_qedoc
|
82
|
+
# markup = Markup.new(File.read(file))
|
83
|
+
# text << markup.to_html
|
84
|
+
when '.rd', '.rdoc', '.qed'
|
85
85
|
require_rdoc
|
86
|
-
markup =
|
87
|
-
|
88
|
-
text << markup.convert(File.read(file), formatter)
|
86
|
+
markup = RDoc::Markup::ToHtml.new
|
87
|
+
text << markup.convert(File.read(file))
|
89
88
|
#text << markup.convert(iotext, formatter)
|
90
89
|
when '.md', '.markdown'
|
91
90
|
require_rdiscount
|
@@ -147,8 +146,8 @@ module QED
|
|
147
146
|
#
|
148
147
|
def require_rdoc
|
149
148
|
@require_rdoc ||= (
|
150
|
-
require 'rdoc/markup/
|
151
|
-
require 'rdoc/markup/simple_markup
|
149
|
+
require 'rdoc/markup/to_html'
|
150
|
+
#require 'rdoc/markup/simple_markup'
|
152
151
|
true
|
153
152
|
)
|
154
153
|
end
|
File without changes
|
data/lib/qed/script.rb
CHANGED
@@ -29,8 +29,13 @@ module QED
|
|
29
29
|
# New Script
|
30
30
|
def initialize(file, output=nil)
|
31
31
|
@file = file
|
32
|
-
@source = File.read(file)
|
33
32
|
@output = output || Reporter::Verbatim.new #(self)
|
33
|
+
|
34
|
+
source = File.read(file)
|
35
|
+
index = source.rindex('---')
|
36
|
+
|
37
|
+
@source = source[0...index]
|
38
|
+
@helper = source[index+3...-1].strip
|
34
39
|
end
|
35
40
|
|
36
41
|
#def convert
|
@@ -40,6 +45,7 @@ module QED
|
|
40
45
|
# Run the script.
|
41
46
|
def run
|
42
47
|
#steps = @source.split(/\n\s*$/)
|
48
|
+
eval(@helper, context._binding, @file) if @helper
|
43
49
|
steps.each do |step|
|
44
50
|
output.report_step(step)
|
45
51
|
case step
|
data/meta/requires
CHANGED
data/meta/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Sawyer <transfire@gmail.com>
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-05 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,6 +22,26 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: "0"
|
24
24
|
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: ansi
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: facets
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
25
45
|
description: |-
|
26
46
|
QED (Quality Enahancing Demos) is a slick Interface-Driven Development
|
27
47
|
(IDD) system utilizing Literate Programming concepts.
|
@@ -33,9 +53,9 @@ extensions: []
|
|
33
53
|
|
34
54
|
extra_rdoc_files:
|
35
55
|
- MANIFEST
|
36
|
-
- LICENSE
|
37
56
|
- README.rdoc
|
38
57
|
- HISTORY
|
58
|
+
- COPYING
|
39
59
|
files:
|
40
60
|
- bin/qed
|
41
61
|
- bin/qedoc
|
@@ -44,27 +64,17 @@ files:
|
|
44
64
|
- demo/qed_helper.rb
|
45
65
|
- doc/qedoc/index.html
|
46
66
|
- doc/qedoc/jquery.js
|
47
|
-
- lib/qed/assertion.rb
|
48
67
|
- lib/qed/document/jquery.js
|
49
68
|
- lib/qed/document/markup.rb
|
50
69
|
- lib/qed/document/template.rhtml
|
51
70
|
- lib/qed/document.rb
|
52
|
-
- lib/qed/
|
53
|
-
- lib/qed/doubles/spy.rb
|
54
|
-
- lib/qed/doubles/stub.rb
|
55
|
-
- lib/qed/expectation.rb
|
56
|
-
- lib/qed/grammar/assert.rb
|
57
|
-
- lib/qed/grammar/expect.rb
|
58
|
-
- lib/qed/grammar/legacy/assert.rb
|
59
|
-
- lib/qed/grammar/should.rb
|
71
|
+
- lib/qed/extract.rb
|
60
72
|
- lib/qed/reporter/base.rb
|
61
73
|
- lib/qed/reporter/dotprogress.rb
|
62
74
|
- lib/qed/reporter/summary.rb
|
63
75
|
- lib/qed/reporter/verbatim.rb
|
64
76
|
- lib/qed/runner.rb
|
65
77
|
- lib/qed/script.rb
|
66
|
-
- lib/qed/utilities/extract.rb
|
67
|
-
- lib/qed/utilities/monitor.rb
|
68
78
|
- lib/qed.rb
|
69
79
|
- meta/authors
|
70
80
|
- meta/created
|
@@ -77,9 +87,9 @@ files:
|
|
77
87
|
- meta/summary
|
78
88
|
- meta/title
|
79
89
|
- meta/version
|
80
|
-
- LICENSE
|
81
90
|
- README.rdoc
|
82
91
|
- HISTORY
|
92
|
+
- COPYING
|
83
93
|
- MANIFEST
|
84
94
|
has_rdoc: true
|
85
95
|
homepage: http://proutils.rubyforge.org/qed
|