qed 2.6.3 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby +4 -3
- data/.yardopts +3 -0
- data/HISTORY.rdoc +71 -35
- data/README.rdoc +9 -10
- data/bin/qed +1 -1
- data/bin/qedoc +2 -1
- data/lib/qed.rb +2 -5
- data/lib/qed.yml +4 -3
- data/lib/qed/applique.rb +57 -24
- data/lib/qed/cli.rb +8 -0
- data/lib/qed/cli/qed.rb +124 -0
- data/lib/qed/demo.rb +35 -39
- data/lib/qed/document.rb +5 -3
- data/lib/qed/document/template.rhtml +1 -0
- data/lib/qed/evaluator.rb +227 -199
- data/lib/qed/parser.rb +60 -282
- data/lib/qed/reporter/abstract.rb +54 -58
- data/lib/qed/reporter/dotprogress.rb +6 -4
- data/lib/qed/reporter/html.rb +112 -31
- data/lib/qed/reporter/tapy.rb +95 -125
- data/lib/qed/reporter/verbatim.rb +80 -38
- data/lib/qed/scope.rb +35 -48
- data/lib/qed/session.rb +35 -140
- data/lib/qed/settings.rb +104 -67
- data/lib/qed/step.rb +237 -0
- data/{spec → qed}/01_demos.rdoc +0 -0
- data/{spec → qed}/02_advice.rdoc +18 -7
- data/qed/03_helpers.rdoc +44 -0
- data/{spec → qed}/04_samples.rdoc +4 -4
- data/{spec → qed}/05_quote.rdoc +3 -3
- data/{spec → qed}/07_toplevel.rdoc +0 -0
- data/{spec → qed}/08_cross_script.rdoc +0 -0
- data/{spec → qed}/09_cross_script.rdoc +0 -0
- data/{spec → qed}/10_constant_lookup.rdoc +2 -2
- data/qed/11_embedded_rules.rdoc +46 -0
- data/{test/integration/topcode.rdoc → qed/99_issues/02_topcode.rdoc} +0 -0
- data/{spec → qed}/applique/constant.rb +0 -0
- data/{spec → qed}/applique/env.rb +0 -0
- data/{spec → qed}/applique/fileutils.rb +0 -0
- data/{spec → qed}/applique/markup.rb +0 -0
- data/{spec → qed}/applique/toplevel.rb +0 -0
- data/{spec → qed}/helpers/advice.rb +6 -7
- data/{spec → qed}/helpers/toplevel.rb +0 -0
- data/{spec → qed}/samples/data.txt +0 -0
- data/{spec → qed}/samples/table.yml +0 -0
- metadata +44 -39
- data/LICENSE.rdoc +0 -31
- data/SPECSHEET.rdoc +0 -456
- data/lib/qed/advice.rb +0 -158
- data/lib/qed/reporter/bullet.rb +0 -91
- data/lib/qed/reporter/dtrace.rb +0 -67
- data/lib/yard-qed.rb +0 -1
- data/spec/03_helpers.rdoc +0 -43
- data/spec/applique/quote.rb +0 -4
- data/spec/helpers/sample.rb +0 -4
data/{spec → qed}/01_demos.rdoc
RENAMED
File without changes
|
data/{spec → qed}/02_advice.rdoc
RENAMED
@@ -5,7 +5,7 @@ They are used to keep demonstrations clean of extraneous,
|
|
5
5
|
repetitive and merely adminstrative code that the reader does
|
6
6
|
not need to see over and over.
|
7
7
|
|
8
|
-
Typically you will want to put advice definitions
|
8
|
+
Typically you will want to put advice definitions in applique
|
9
9
|
files, rather then place them directly in the demonstration
|
10
10
|
document, but you can do so, as you will see in this document.
|
11
11
|
|
@@ -98,13 +98,13 @@ to be run when the event is triggered.
|
|
98
98
|
|
99
99
|
x = []
|
100
100
|
|
101
|
-
When(:
|
101
|
+
When(:step) do |section|
|
102
102
|
section.text.scan(/^\*(.*?)$/) do |m|
|
103
103
|
x << $1.strip
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
-
|
107
|
+
Now let's see if it worked.
|
108
108
|
|
109
109
|
* SampleA
|
110
110
|
* SampleB
|
@@ -119,6 +119,17 @@ So +x+ should now contain these three list samples.
|
|
119
119
|
QED also supports comment match triggers. With the +When+ method one can
|
120
120
|
define procedures to run when a given pattern matches comment text.
|
121
121
|
|
122
|
+
When 'given the facts' do
|
123
|
+
@facts = "this is truth"
|
124
|
+
end
|
125
|
+
|
126
|
+
Then whenever the words, 'given the facts' appear in step description
|
127
|
+
the `@facts` varaible will be set.
|
128
|
+
|
129
|
+
@facts.assert == "this is truth"
|
130
|
+
|
131
|
+
Pattern matchers reall shine when we also add captures to the mix.
|
132
|
+
|
122
133
|
When 'given a setting @a equal to (((\d+)))' do |n|
|
123
134
|
@a = n.to_i
|
124
135
|
end
|
@@ -140,12 +151,12 @@ so any number can be used. For example, "given a setting @a equal to 2".
|
|
140
151
|
When clauses can also use consecutive pattern matching. For instance
|
141
152
|
we could write,
|
142
153
|
|
143
|
-
|
144
|
-
|
145
|
-
|
154
|
+
When 'first match #(((\d+)))', 'then match #(((\d+)))' do |i1, i2|
|
155
|
+
@a = [i1.to_i, i2.to_i]
|
156
|
+
end
|
146
157
|
|
147
158
|
So that 'first match #1' will be looked for first, and only after
|
148
|
-
that if 'then match #2' is found, will it be
|
159
|
+
that if 'then match #2' is found, will it be considered a complete match.
|
149
160
|
All regular expression slots are collected from all matches and passed to
|
150
161
|
the block. We can see that the rule matched this very paragraph.
|
151
162
|
|
data/qed/03_helpers.rdoc
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
= Helpers
|
2
|
+
|
3
|
+
There are two ways to load advice scripts. Manually loaded
|
4
|
+
helpers act per demonstrandum and apply only to the currently
|
5
|
+
executing demo. Automaticly loaded helpers apply to all
|
6
|
+
demonstrandum within their preview.
|
7
|
+
|
8
|
+
Helper scripts can be written just like demonstration scripts,
|
9
|
+
or they can be defined as pure Ruby scripts.
|
10
|
+
|
11
|
+
== Automatic Helpers
|
12
|
+
|
13
|
+
Automatic helpers, known as the "applique" are loaded at the
|
14
|
+
start of a session and apply equally to all demonstrandum within
|
15
|
+
the same or lower directory as teh demo. These helpers are placed
|
16
|
+
in an +applique+ subdirectory. For instance this document uses,
|
17
|
+
{applique/env.rb}[applique/env.rb].
|
18
|
+
|
19
|
+
== Manual Helpers
|
20
|
+
|
21
|
+
Manual helpers are loaded per-demonstration by using specially
|
22
|
+
marked links.
|
23
|
+
|
24
|
+
For example, because this link, Advice[qed://helpers/advice.rb],
|
25
|
+
begins with +qed:+, it will be used to load a helper. We can
|
26
|
+
see this with the following assertion.
|
27
|
+
|
28
|
+
pudding.assert.include?('loaded advice.rb')
|
29
|
+
|
30
|
+
No where in the demonstration have we defined +pudding+, but
|
31
|
+
it has been defined for us in the advice.rb helper script.
|
32
|
+
|
33
|
+
We can also see that the generic When clause in our advice
|
34
|
+
helper is keeping count of decriptive paragraphs. Since the
|
35
|
+
helper script was loaded two paragraphs back, the next count
|
36
|
+
will be 3.
|
37
|
+
|
38
|
+
count.assert == 3
|
39
|
+
|
40
|
+
Helpers are vital to building test-demonstration suites for
|
41
|
+
applications. But here again, only use them as necessary.
|
42
|
+
The more helpers you use the more difficult your demos will
|
43
|
+
be to follow.
|
44
|
+
|
@@ -6,12 +6,12 @@ When creating testable demonstrations, there are times when sizable
|
|
6
6
|
chunks of data are needed. It is convenient to store such data in
|
7
7
|
separate files. The +Data+ method makes is easy to utilize them.
|
8
8
|
|
9
|
-
Data('
|
9
|
+
Data(File.dirname(__FILE__) + '/samples/data.txt').assert =~ /dolor/
|
10
10
|
|
11
11
|
The +Data+ method can also take a block which passes the data
|
12
|
-
as the
|
12
|
+
as the blocks only argument.
|
13
13
|
|
14
|
-
Data('
|
14
|
+
Data(File.dirname(__FILE__) + '/samples/data.txt') do |data|
|
15
15
|
data.assert =~ /dolor/
|
16
16
|
end
|
17
17
|
|
@@ -32,7 +32,7 @@ the coded step. Consider the following example.
|
|
32
32
|
Every row in the {table.yml table}[table.yml] will be assigned to
|
33
33
|
the block parameters and run through the subsequent assertion.
|
34
34
|
|
35
|
-
Table '
|
35
|
+
Table File.dirname(__FILE__) + '/samples/table.yml' do |x, y|
|
36
36
|
x.upcase.assert == y
|
37
37
|
end
|
38
38
|
|
data/{spec → qed}/05_quote.rdoc
RENAMED
@@ -5,15 +5,15 @@ Sometimes it would more useful to treat them a plain text to
|
|
5
5
|
which the preceeding paragraph can make use in a processing rule.
|
6
6
|
|
7
7
|
For example let say we want to make an example out of the following
|
8
|
-
text
|
8
|
+
text:
|
9
9
|
|
10
10
|
The file will contain
|
11
11
|
|
12
12
|
this text
|
13
13
|
|
14
|
-
The use of the
|
14
|
+
The use of the colon (`:`) tells the processor that the next
|
15
15
|
segment is a plain text continuation of the current segment, rather
|
16
|
-
than
|
16
|
+
than executable code. If the next segment is varbatim it will be added to
|
17
17
|
the end of the arguments list of any applicable processing rule.
|
18
18
|
|
19
19
|
Behind the scenes we created a rule to set the text to an instance
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,13 +1,13 @@
|
|
1
1
|
= Missing Constant
|
2
2
|
|
3
3
|
If a constant is missing it is because it was not found
|
4
|
-
in either the demos scope, the applique or the toplevel.
|
4
|
+
in either the demos scope, the applique or at the toplevel.
|
5
5
|
|
6
6
|
begin
|
7
7
|
UnknownConstant
|
8
8
|
rescue => err
|
9
9
|
# no colon means toplevel
|
10
|
-
|
10
|
+
err.name.to_s.refute.include?('::')
|
11
11
|
end
|
12
12
|
|
13
13
|
A constant defined in the applique is visible.
|
@@ -0,0 +1,46 @@
|
|
1
|
+
= Meta Code
|
2
|
+
|
3
|
+
All code steps are evaluated in a rescue clause. If an error occurs, it
|
4
|
+
is captured and reported through the test report, and execution continues.
|
5
|
+
However, sometimes this is not desired. To evaluate a step without the
|
6
|
+
rescue clause, and effective *fail fast*, append `^` mark to the end of
|
7
|
+
the desription text, like so. ^
|
8
|
+
|
9
|
+
When 'this is cool' do |text|
|
10
|
+
@text = text
|
11
|
+
end
|
12
|
+
|
13
|
+
Now, let's try it by saying, "this is cool":
|
14
|
+
|
15
|
+
And this is the text.
|
16
|
+
|
17
|
+
Did it work?
|
18
|
+
|
19
|
+
@text.assert == "And this is the text."
|
20
|
+
|
21
|
+
|
22
|
+
== Match Separator
|
23
|
+
|
24
|
+
The `When` method can take a list of String or Regexp as arguments.
|
25
|
+
If any of the strings contain `...`, the string will be split into
|
26
|
+
two at this point, which effective means that any text can occur
|
27
|
+
within this space. It behaves much like adding `((*.?))`, but parses
|
28
|
+
more quickly by dividing the string into multiple matches.
|
29
|
+
|
30
|
+
When 'Let /(\w+)/ be ... scared of /(\w+)/' do |name, monster|
|
31
|
+
@name = name
|
32
|
+
@monster = monster
|
33
|
+
end
|
34
|
+
|
35
|
+
Okay let's try it: Let John be very scared of Zombies.
|
36
|
+
|
37
|
+
So now what is the name?
|
38
|
+
|
39
|
+
@name.assert == "John"
|
40
|
+
|
41
|
+
What is the monster?
|
42
|
+
|
43
|
+
@monster.assert == "Zombies"
|
44
|
+
|
45
|
+
Did it work?
|
46
|
+
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,16 +1,15 @@
|
|
1
|
-
# This helper is used to demonstrate
|
2
|
-
# the use of advice --before, after
|
1
|
+
# This helper is used to demonstrate the use of advice --before, after
|
3
2
|
# and when clauses.
|
4
3
|
|
5
4
|
count = 0
|
6
5
|
pudding = []
|
7
6
|
|
8
|
-
|
9
|
-
pudding << "load #{File.basename(__FILE__)}"
|
10
|
-
end
|
7
|
+
#Before(:import) do
|
8
|
+
# pudding << "load #{File.basename(__FILE__)}"
|
9
|
+
#end
|
11
10
|
|
12
|
-
|
13
|
-
pudding << "
|
11
|
+
After(:import) do
|
12
|
+
pudding << "loaded #{File.basename(__FILE__)}"
|
14
13
|
end
|
15
14
|
|
16
15
|
#Before do
|
File without changes
|
File without changes
|
File without changes
|
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: 2.
|
4
|
+
version: 2.7.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ansi
|
16
|
-
requirement: &
|
16
|
+
requirement: &70171077943540 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70171077943540
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: facets
|
27
|
-
requirement: &
|
27
|
+
requirement: &70171077942820 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '2.8'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70171077942820
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: ae
|
38
|
-
requirement: &
|
38
|
+
requirement: &70171077942200 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,21 @@ dependencies:
|
|
43
43
|
version: '1.7'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70171077942200
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: confection
|
49
|
+
requirement: &70171077941740 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70171077941740
|
47
58
|
- !ruby/object:Gem::Dependency
|
48
59
|
name: detroit
|
49
|
-
requirement: &
|
60
|
+
requirement: &70171077941200 !ruby/object:Gem::Requirement
|
50
61
|
none: false
|
51
62
|
requirements:
|
52
63
|
- - ! '>='
|
@@ -54,7 +65,7 @@ dependencies:
|
|
54
65
|
version: '0'
|
55
66
|
type: :development
|
56
67
|
prerelease: false
|
57
|
-
version_requirements: *
|
68
|
+
version_requirements: *70171077941200
|
58
69
|
description: ! 'QED (Quality Ensured Demonstrations) is a TDD/BDD framework
|
59
70
|
|
60
71
|
utilizing Literate Programming techniques.'
|
@@ -66,17 +77,16 @@ executables:
|
|
66
77
|
extensions: []
|
67
78
|
extra_rdoc_files:
|
68
79
|
- HISTORY.rdoc
|
69
|
-
- SPECSHEET.rdoc
|
70
80
|
- README.rdoc
|
71
|
-
- LICENSE.rdoc
|
72
81
|
files:
|
73
82
|
- .ruby
|
74
83
|
- .yardopts
|
75
84
|
- bin/qed
|
76
85
|
- bin/qedoc
|
77
|
-
- lib/qed/advice.rb
|
78
86
|
- lib/qed/applique.rb
|
87
|
+
- lib/qed/cli/qed.rb
|
79
88
|
- lib/qed/cli/qedoc.rb
|
89
|
+
- lib/qed/cli.rb
|
80
90
|
- lib/qed/core_ext.rb
|
81
91
|
- lib/qed/demo.rb
|
82
92
|
- lib/qed/document/jquery.js
|
@@ -88,43 +98,38 @@ files:
|
|
88
98
|
- lib/qed/helpers/shell_session.rb
|
89
99
|
- lib/qed/parser.rb
|
90
100
|
- lib/qed/reporter/abstract.rb
|
91
|
-
- lib/qed/reporter/bullet.rb
|
92
101
|
- lib/qed/reporter/dotprogress.rb
|
93
|
-
- lib/qed/reporter/dtrace.rb
|
94
102
|
- lib/qed/reporter/html.rb
|
95
103
|
- lib/qed/reporter/tapy.rb
|
96
104
|
- lib/qed/reporter/verbatim.rb
|
97
105
|
- lib/qed/scope.rb
|
98
106
|
- lib/qed/session.rb
|
99
107
|
- lib/qed/settings.rb
|
108
|
+
- lib/qed/step.rb
|
100
109
|
- lib/qed.rb
|
101
110
|
- lib/qed.yml
|
102
|
-
-
|
103
|
-
-
|
104
|
-
-
|
105
|
-
-
|
106
|
-
-
|
107
|
-
-
|
108
|
-
-
|
109
|
-
-
|
110
|
-
-
|
111
|
-
-
|
112
|
-
-
|
113
|
-
-
|
114
|
-
-
|
115
|
-
-
|
116
|
-
-
|
117
|
-
-
|
118
|
-
-
|
119
|
-
-
|
120
|
-
-
|
121
|
-
-
|
122
|
-
- spec/samples/table.yml
|
123
|
-
- test/integration/topcode.rdoc
|
111
|
+
- qed/01_demos.rdoc
|
112
|
+
- qed/02_advice.rdoc
|
113
|
+
- qed/03_helpers.rdoc
|
114
|
+
- qed/04_samples.rdoc
|
115
|
+
- qed/05_quote.rdoc
|
116
|
+
- qed/07_toplevel.rdoc
|
117
|
+
- qed/08_cross_script.rdoc
|
118
|
+
- qed/09_cross_script.rdoc
|
119
|
+
- qed/10_constant_lookup.rdoc
|
120
|
+
- qed/11_embedded_rules.rdoc
|
121
|
+
- qed/99_issues/02_topcode.rdoc
|
122
|
+
- qed/applique/constant.rb
|
123
|
+
- qed/applique/env.rb
|
124
|
+
- qed/applique/fileutils.rb
|
125
|
+
- qed/applique/markup.rb
|
126
|
+
- qed/applique/toplevel.rb
|
127
|
+
- qed/helpers/advice.rb
|
128
|
+
- qed/helpers/toplevel.rb
|
129
|
+
- qed/samples/data.txt
|
130
|
+
- qed/samples/table.yml
|
124
131
|
- HISTORY.rdoc
|
125
|
-
- SPECSHEET.rdoc
|
126
132
|
- README.rdoc
|
127
|
-
- LICENSE.rdoc
|
128
133
|
homepage: http://rubyworks.github.com/qed
|
129
134
|
licenses:
|
130
135
|
- BSD-2-Clause
|
data/LICENSE.rdoc
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
= COPYRIGHT NOTICES
|
2
|
-
|
3
|
-
== QED
|
4
|
-
|
5
|
-
Copyright:: (c) 2007 Rubyworks, Thomas Sawyer
|
6
|
-
License:: BSD-2-Clause
|
7
|
-
Website:: http://rubyworks.github.com/yes
|
8
|
-
|
9
|
-
Copyright 2007 Thomas Sawyer, Rubyworks. All rights reserved.
|
10
|
-
|
11
|
-
Redistribution and use in source and binary forms, with or without
|
12
|
-
modification, are permitted provided that the following conditions are met:
|
13
|
-
|
14
|
-
* Redistributions of source code must retain the above copyright notice,
|
15
|
-
this list of conditions and the following disclaimer.
|
16
|
-
|
17
|
-
* Redistributions in binary form must reproduce the above copyright notice,
|
18
|
-
this list of conditions and the following disclaimer in the documentation
|
19
|
-
and/or other materials provided with the distribution.
|
20
|
-
|
21
|
-
THIS SOFTWARE IS PROVIDED BY Thomas Sawyer ``AS IS'' AND ANY EXPRESS
|
22
|
-
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
23
|
-
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
24
|
-
NO EVENT SHALL Thomas Sawyer OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
25
|
-
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
26
|
-
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
27
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
28
|
-
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
29
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
30
|
-
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
-
|