dfect 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +15 -0
- data/doc/api/classes/Dfect.html +872 -0
- data/doc/api/classes/Object.html +72 -0
- data/doc/api/created.rid +1 -0
- data/doc/api/css/main.css +263 -0
- data/doc/api/css/panel.css +383 -0
- data/doc/api/css/reset.css +53 -0
- data/doc/api/files/ANN_txt.html +80 -0
- data/doc/api/files/LICENSE.html +74 -0
- data/doc/api/files/lib/dfect/auto_rb.html +78 -0
- data/doc/api/files/lib/dfect_rb.html +72 -0
- data/doc/api/i/arrows.png +0 -0
- data/doc/api/i/results_bg.png +0 -0
- data/doc/api/i/tree_bg.png +0 -0
- data/doc/api/index.html +14 -0
- data/doc/api/js/jquery-1.3.2.min.js +19 -0
- data/doc/api/js/jquery-effect.js +593 -0
- data/doc/api/js/main.js +22 -0
- data/doc/api/js/searchdoc.js +606 -0
- data/doc/api/panel/index.html +63 -0
- data/doc/api/panel/search_index.js +1 -0
- data/doc/api/panel/tree.js +1 -0
- data/doc/history.erb +4 -0
- data/doc/index.erb +6 -0
- data/doc/intro.erb +78 -0
- data/doc/setup.erb +34 -0
- data/doc/usage.erb +186 -0
- data/lib/dfect/auto.rb +24 -0
- data/lib/dfect.rb +621 -0
- data/rakefile +19 -0
- data/test/dfect.rb +146 -0
- metadata +95 -0
data/test/dfect.rb
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright 2009 Suraj N. Kurapati
|
3
|
+
# See the LICENSE file for details.
|
4
|
+
#++
|
5
|
+
|
6
|
+
require 'dfect/auto'
|
7
|
+
|
8
|
+
D 'T()' do
|
9
|
+
T { true }
|
10
|
+
T { !false }
|
11
|
+
T { !nil }
|
12
|
+
|
13
|
+
T { 0 }
|
14
|
+
T { 1 }
|
15
|
+
|
16
|
+
D 'must return block value' do
|
17
|
+
inner = rand()
|
18
|
+
outer = T { inner }
|
19
|
+
|
20
|
+
T { inner == outer }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
D 'F()' do
|
25
|
+
F { !true }
|
26
|
+
F { false }
|
27
|
+
F { nil }
|
28
|
+
|
29
|
+
D 'must return block value' do
|
30
|
+
inner = false
|
31
|
+
outer = F { inner }
|
32
|
+
|
33
|
+
T { inner == outer }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
D 'E()' do
|
38
|
+
E SyntaxError do
|
39
|
+
raise SyntaxError
|
40
|
+
end
|
41
|
+
|
42
|
+
D 'allows nested rescue' do
|
43
|
+
klass = Class.new(Exception)
|
44
|
+
|
45
|
+
E SyntaxError do
|
46
|
+
begin
|
47
|
+
raise ArgumentError
|
48
|
+
rescue
|
49
|
+
end
|
50
|
+
|
51
|
+
raise SyntaxError
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
D 'C()' do
|
57
|
+
C :foo do
|
58
|
+
throw :foo
|
59
|
+
end
|
60
|
+
|
61
|
+
D 'allows nested catch' do
|
62
|
+
C :foo do
|
63
|
+
catch :bar do
|
64
|
+
throw :bar
|
65
|
+
end
|
66
|
+
|
67
|
+
throw :foo
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
D 'D()' do
|
73
|
+
history = []
|
74
|
+
|
75
|
+
D .<< { history << :before_all }
|
76
|
+
D .< { history << :before_each }
|
77
|
+
D .> { history << :after_each }
|
78
|
+
D .>> { history << :after_all }
|
79
|
+
|
80
|
+
D 'first nesting' do
|
81
|
+
T { history.select {|x| x == :before_all }.length == 1 }
|
82
|
+
T { history.select {|x| x == :before_each }.length == 1 }
|
83
|
+
F { history.select {|x| x == :after_each }.length == 1 }
|
84
|
+
T { history.select {|x| x == :after_all }.length == 0 }
|
85
|
+
end
|
86
|
+
|
87
|
+
D 'second nesting' do
|
88
|
+
T { history.select {|x| x == :before_all }.length == 1 }
|
89
|
+
T { history.select {|x| x == :before_each }.length == 2 }
|
90
|
+
T { history.select {|x| x == :after_each }.length == 1 }
|
91
|
+
T { history.select {|x| x == :after_all }.length == 0 }
|
92
|
+
end
|
93
|
+
|
94
|
+
D 'third nesting' do
|
95
|
+
T { history.select {|x| x == :before_all }.length == 1 }
|
96
|
+
T { history.select {|x| x == :before_each }.length == 3 }
|
97
|
+
T { history.select {|x| x == :after_each }.length == 2 }
|
98
|
+
T { history.select {|x| x == :after_all }.length == 0 }
|
99
|
+
end
|
100
|
+
|
101
|
+
D 'fourth nesting' do
|
102
|
+
D .<< { history << :nested_before_all }
|
103
|
+
D .< { history << :nested_before_each }
|
104
|
+
D .> { history << :nested_after_each }
|
105
|
+
D .>> { history << :nested_after_all }
|
106
|
+
|
107
|
+
nested_before_each = 0
|
108
|
+
|
109
|
+
D .< do
|
110
|
+
# outer values remain the same for this nesting
|
111
|
+
T { history.select {|x| x == :before_all }.length == 1 }
|
112
|
+
T { history.select {|x| x == :before_each }.length == 4 }
|
113
|
+
T { history.select {|x| x == :after_each }.length == 3 }
|
114
|
+
T { history.select {|x| x == :after_all }.length == 0 }
|
115
|
+
|
116
|
+
nested_before_each += 1
|
117
|
+
T { history.select {|x| x == :nested_before_each }.length == nested_before_each }
|
118
|
+
end
|
119
|
+
|
120
|
+
D 'first double-nesting' do
|
121
|
+
T { history.select {|x| x == :nested_before_all }.length == 1 }
|
122
|
+
T { history.select {|x| x == :nested_before_each }.length == 1 }
|
123
|
+
F { history.select {|x| x == :nested_after_each }.length == 1 }
|
124
|
+
T { history.select {|x| x == :nested_after_all }.length == 0 }
|
125
|
+
end
|
126
|
+
|
127
|
+
D 'second double-nesting' do
|
128
|
+
T { history.select {|x| x == :nested_before_all }.length == 1 }
|
129
|
+
T { history.select {|x| x == :nested_before_each }.length == 2 }
|
130
|
+
T { history.select {|x| x == :nested_after_each }.length == 1 }
|
131
|
+
T { history.select {|x| x == :nested_after_all }.length == 0 }
|
132
|
+
end
|
133
|
+
|
134
|
+
D 'third double-nesting' do
|
135
|
+
T { history.select {|x| x == :nested_before_all }.length == 1 }
|
136
|
+
T { history.select {|x| x == :nested_before_each }.length == 3 }
|
137
|
+
T { history.select {|x| x == :nested_after_each }.length == 2 }
|
138
|
+
T { history.select {|x| x == :nested_after_all }.length == 0 }
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
D 'stoping #run' do
|
144
|
+
Dfect.stop
|
145
|
+
raise 'this must not be reached!'
|
146
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dfect
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Suraj N. Kurapati
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-04-13 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Assertion testing library for Ruby
|
17
|
+
email: sunaku@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- rakefile
|
26
|
+
- test
|
27
|
+
- test/dfect.rb
|
28
|
+
- lib
|
29
|
+
- lib/dfect
|
30
|
+
- lib/dfect/auto.rb
|
31
|
+
- lib/dfect.rb
|
32
|
+
- LICENSE
|
33
|
+
- doc
|
34
|
+
- doc/intro.erb
|
35
|
+
- doc/setup.erb
|
36
|
+
- doc/api/classes
|
37
|
+
- doc/api/classes/Object.html
|
38
|
+
- doc/api/classes/Dfect.html
|
39
|
+
- doc/api/panel
|
40
|
+
- doc/api/panel/search_index.js
|
41
|
+
- doc/api/panel/tree.js
|
42
|
+
- doc/api/panel/index.html
|
43
|
+
- doc/api/js
|
44
|
+
- doc/api/js/searchdoc.js
|
45
|
+
- doc/api/js/jquery-effect.js
|
46
|
+
- doc/api/js/jquery-1.3.2.min.js
|
47
|
+
- doc/api/js/main.js
|
48
|
+
- doc/api/files
|
49
|
+
- doc/api/files/LICENSE.html
|
50
|
+
- doc/api/files/lib
|
51
|
+
- doc/api/files/lib/dfect_rb.html
|
52
|
+
- doc/api/files/lib/dfect
|
53
|
+
- doc/api/files/lib/dfect/auto_rb.html
|
54
|
+
- doc/api/files/ANN_txt.html
|
55
|
+
- doc/api/css
|
56
|
+
- doc/api/css/main.css
|
57
|
+
- doc/api/css/reset.css
|
58
|
+
- doc/api/css/panel.css
|
59
|
+
- doc/api/i
|
60
|
+
- doc/api/i/arrows.png
|
61
|
+
- doc/api/i/tree_bg.png
|
62
|
+
- doc/api/i/results_bg.png
|
63
|
+
- doc/api/created.rid
|
64
|
+
- doc/api/index.html
|
65
|
+
- doc/usage.erb
|
66
|
+
- doc/history.erb
|
67
|
+
- doc/index.erb
|
68
|
+
has_rdoc: true
|
69
|
+
homepage: http://snk.tuxfamily.org/lib/dfect
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: "0"
|
80
|
+
version:
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: "0"
|
86
|
+
version:
|
87
|
+
requirements: []
|
88
|
+
|
89
|
+
rubyforge_project: sunaku
|
90
|
+
rubygems_version: 1.3.1
|
91
|
+
signing_key:
|
92
|
+
specification_version: 2
|
93
|
+
summary: Assertion testing library for Ruby
|
94
|
+
test_files: []
|
95
|
+
|