BanzaiMan-ZenTest 4.2

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.
@@ -0,0 +1,242 @@
1
+ $TESTING = true
2
+
3
+ require 'rubygems'
4
+ require 'minitest/autorun'
5
+
6
+ require 'zentest_mapping' unless defined? $ZENTEST
7
+
8
+ class Dummy
9
+ attr_accessor :inherited_methods
10
+ include ZenTestMapping
11
+ end
12
+
13
+ class TestZentestMapping < MiniTest::Unit::TestCase
14
+ def setup
15
+ @tester = Dummy.new
16
+ end
17
+
18
+ def util_simple_setup
19
+ klasses = {
20
+ "Something" => {
21
+ "method1" => true,
22
+ "method1!" => true,
23
+ "method1=" => true,
24
+ "method1?" => true,
25
+ "attrib" => true,
26
+ "attrib=" => true,
27
+ "equal?" => true,
28
+ "self.method3" => true,
29
+ "self.[]" => true,
30
+ },
31
+ }
32
+ test_klasses = {
33
+ "TestSomething" => {
34
+ "test_class_method4" => true,
35
+ "test_method2" => true,
36
+ "setup" => true,
37
+ "teardown" => true,
38
+ "test_class_index" => true,
39
+ },
40
+ }
41
+ @tester.inherited_methods = test_klasses.merge(klasses)
42
+ @generated_code = "
43
+ require 'test/unit' unless defined? $ZENTEST and $ZENTEST
44
+
45
+ class Something
46
+ def self.method4(*args)
47
+ raise NotImplementedError, 'Need to write self.method4'
48
+ end
49
+
50
+ def method2(*args)
51
+ raise NotImplementedError, 'Need to write method2'
52
+ end
53
+ end
54
+
55
+ class TestSomething < Test::Unit::TestCase
56
+ def test_class_method3
57
+ raise NotImplementedError, 'Need to write test_class_method3'
58
+ end
59
+
60
+ def test_attrib
61
+ raise NotImplementedError, 'Need to write test_attrib'
62
+ end
63
+
64
+ def test_attrib_equals
65
+ raise NotImplementedError, 'Need to write test_attrib_equals'
66
+ end
67
+
68
+ def test_equal_eh
69
+ raise NotImplementedError, 'Need to write test_equal_eh'
70
+ end
71
+
72
+ def test_method1
73
+ raise NotImplementedError, 'Need to write test_method1'
74
+ end
75
+
76
+ def test_method1_bang
77
+ raise NotImplementedError, 'Need to write test_method1_bang'
78
+ end
79
+
80
+ def test_method1_eh
81
+ raise NotImplementedError, 'Need to write test_method1_eh'
82
+ end
83
+
84
+ def test_method1_equals
85
+ raise NotImplementedError, 'Need to write test_method1_equals'
86
+ end
87
+ end
88
+
89
+ # Number of errors detected: 10
90
+ "
91
+ end
92
+
93
+ def test_normal_to_test
94
+ self.util_simple_setup
95
+ assert_equal("test_method1", @tester.normal_to_test("method1"))
96
+ assert_equal("test_method1_bang", @tester.normal_to_test("method1!"))
97
+ assert_equal("test_method1_eh", @tester.normal_to_test("method1?"))
98
+ assert_equal("test_method1_equals", @tester.normal_to_test("method1="))
99
+ end
100
+
101
+ def test_normal_to_test_cls
102
+ self.util_simple_setup
103
+ assert_equal("test_class_method1",
104
+ @tester.normal_to_test("self.method1"))
105
+ assert_equal("test_class_method1_bang",
106
+ @tester.normal_to_test("self.method1!"))
107
+ assert_equal("test_class_method1_eh",
108
+ @tester.normal_to_test("self.method1?"))
109
+ assert_equal("test_class_method1_equals",
110
+ @tester.normal_to_test("self.method1="))
111
+ end
112
+
113
+ def test_normal_to_test_operators
114
+ self.util_simple_setup
115
+ assert_equal("test_and", @tester.normal_to_test("&"))
116
+ assert_equal("test_bang", @tester.normal_to_test("!"))
117
+ assert_equal("test_carat", @tester.normal_to_test("^"))
118
+ assert_equal("test_div", @tester.normal_to_test("/"))
119
+ assert_equal("test_equalstilde", @tester.normal_to_test("=~"))
120
+ assert_equal("test_minus", @tester.normal_to_test("-"))
121
+ assert_equal("test_or", @tester.normal_to_test("|"))
122
+ assert_equal("test_percent", @tester.normal_to_test("%"))
123
+ assert_equal("test_plus", @tester.normal_to_test("+"))
124
+ assert_equal("test_tilde", @tester.normal_to_test("~"))
125
+ end
126
+
127
+ def test_normal_to_test_overlap
128
+ self.util_simple_setup
129
+ assert_equal("test_equals2", @tester.normal_to_test("=="))
130
+ assert_equal("test_equals3", @tester.normal_to_test("==="))
131
+ assert_equal("test_ge", @tester.normal_to_test(">="))
132
+ assert_equal("test_gt", @tester.normal_to_test(">"))
133
+ assert_equal("test_gt2", @tester.normal_to_test(">>"))
134
+ assert_equal("test_index", @tester.normal_to_test("[]"))
135
+ assert_equal("test_index_equals", @tester.normal_to_test("[]="))
136
+ assert_equal("test_lt", @tester.normal_to_test("<"))
137
+ assert_equal("test_lt2", @tester.normal_to_test("<\<"))
138
+ assert_equal("test_lte", @tester.normal_to_test("<="))
139
+ assert_equal("test_method", @tester.normal_to_test("method"))
140
+ assert_equal("test_method_equals", @tester.normal_to_test("method="))
141
+ assert_equal("test_spaceship", @tester.normal_to_test("<=>"))
142
+ assert_equal("test_times", @tester.normal_to_test("*"))
143
+ assert_equal("test_times2", @tester.normal_to_test("**"))
144
+ assert_equal("test_unary_minus", @tester.normal_to_test("-@"))
145
+ assert_equal("test_unary_plus", @tester.normal_to_test("+@"))
146
+ assert_equal("test_class_index", @tester.normal_to_test("self.[]"))
147
+ end
148
+
149
+ def test_test_to_normal
150
+ self.util_simple_setup
151
+ assert_equal("method1!",
152
+ @tester.test_to_normal("test_method1_bang", "Something"))
153
+ assert_equal("method1",
154
+ @tester.test_to_normal("test_method1", "Something"))
155
+ assert_equal("method1=",
156
+ @tester.test_to_normal("test_method1_equals", "Something"))
157
+ assert_equal("method1?",
158
+ @tester.test_to_normal("test_method1_eh", "Something"))
159
+ end
160
+
161
+ def test_test_to_normal_cls
162
+ self.util_simple_setup
163
+ assert_equal("self.method1",
164
+ @tester.test_to_normal("test_class_method1"))
165
+ assert_equal("self.method1!",
166
+ @tester.test_to_normal("test_class_method1_bang"))
167
+ assert_equal("self.method1?",
168
+ @tester.test_to_normal("test_class_method1_eh"))
169
+ assert_equal("self.method1=",
170
+ @tester.test_to_normal("test_class_method1_equals"))
171
+ assert_equal("self.[]",
172
+ @tester.test_to_normal("test_class_index"))
173
+ end
174
+
175
+ def test_test_to_normal_extended
176
+ self.util_simple_setup
177
+ assert_equal("equal?",
178
+ @tester.test_to_normal("test_equal_eh_extension",
179
+ "Something"))
180
+ assert_equal("equal?",
181
+ @tester.test_to_normal("test_equal_eh_extension_again",
182
+ "Something"))
183
+ assert_equal("method1",
184
+ @tester.test_to_normal("test_method1_extension",
185
+ "Something"))
186
+ assert_equal("method1",
187
+ @tester.test_to_normal("test_method1_extension_again",
188
+ "Something"))
189
+ end
190
+
191
+ def test_test_to_normal_mapped
192
+ self.util_simple_setup
193
+ assert_equal("*", @tester.test_to_normal("test_times"))
194
+ assert_equal("*", @tester.test_to_normal("test_times_ext"))
195
+ assert_equal("==", @tester.test_to_normal("test_equals2"))
196
+ assert_equal("==", @tester.test_to_normal("test_equals2_ext"))
197
+ assert_equal("===", @tester.test_to_normal("test_equals3"))
198
+ assert_equal("===", @tester.test_to_normal("test_equals3_ext"))
199
+ assert_equal("[]", @tester.test_to_normal("test_index"))
200
+ assert_equal("[]", @tester.test_to_normal("test_index_ext"))
201
+ assert_equal("[]=", @tester.test_to_normal("test_index_equals"))
202
+ assert_equal("[]=", @tester.test_to_normal("test_index_equals_ext"))
203
+ end
204
+
205
+ def test_test_to_normal_operators
206
+ self.util_simple_setup
207
+ assert_equal("&", @tester.test_to_normal("test_and"))
208
+ assert_equal("!", @tester.test_to_normal("test_bang"))
209
+ assert_equal("^", @tester.test_to_normal("test_carat"))
210
+ assert_equal("/", @tester.test_to_normal("test_div"))
211
+ assert_equal("=~", @tester.test_to_normal("test_equalstilde"))
212
+ assert_equal("-", @tester.test_to_normal("test_minus"))
213
+ assert_equal("|", @tester.test_to_normal("test_or"))
214
+ assert_equal("%", @tester.test_to_normal("test_percent"))
215
+ assert_equal("+", @tester.test_to_normal("test_plus"))
216
+ assert_equal("~", @tester.test_to_normal("test_tilde"))
217
+ end
218
+
219
+ def test_test_to_normal_overlap
220
+ self.util_simple_setup
221
+ assert_equal("==", @tester.test_to_normal("test_equals2"))
222
+ assert_equal("===", @tester.test_to_normal("test_equals3"))
223
+ assert_equal(">=", @tester.test_to_normal("test_ge"))
224
+ assert_equal(">", @tester.test_to_normal("test_gt"))
225
+ assert_equal(">>", @tester.test_to_normal("test_gt2"))
226
+ assert_equal("[]", @tester.test_to_normal("test_index"))
227
+ assert_equal("[]=", @tester.test_to_normal("test_index_equals"))
228
+ assert_equal("<", @tester.test_to_normal("test_lt"))
229
+ assert_equal("<\<", @tester.test_to_normal("test_lt2"))
230
+ assert_equal("<=", @tester.test_to_normal("test_lte"))
231
+ assert_equal("<=>", @tester.test_to_normal("test_spaceship"))
232
+ assert_equal("*", @tester.test_to_normal("test_times"))
233
+ assert_equal("**", @tester.test_to_normal("test_times2"))
234
+ assert_equal("-@", @tester.test_to_normal("test_unary_minus"))
235
+ assert_equal("+@", @tester.test_to_normal("test_unary_plus"))
236
+ end
237
+
238
+ def test_to_normal_subset
239
+ self.util_simple_setup
240
+ assert_equal("get_foo", @tester.test_to_normal("test_get_foo"))
241
+ end
242
+ end
metadata ADDED
@@ -0,0 +1,126 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: BanzaiMan-ZenTest
3
+ version: !ruby/object:Gem::Version
4
+ version: "4.2"
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Davis
8
+ - Eric Hodel
9
+ - Hiro Asari
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+
14
+ date: 2009-08-02 00:00:00 -07:00
15
+ default_executable:
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: minitest
19
+ type: :runtime
20
+ version_requirement:
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: "0"
26
+ version:
27
+ - !ruby/object:Gem::Dependency
28
+ name: hoe
29
+ type: :development
30
+ version_requirement:
31
+ version_requirements: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 2.3.2
36
+ version:
37
+ description: "ZenTest provides 4 different tools: zentest, unit_diff, autotest, and multiruby. ZenTest scans your target and unit-test code and writes your missing code based on simple naming rules, enabling XP at a much quicker pace. ZenTest only works with Ruby and Test::Unit. Nobody uses this tool anymore but it is the package namesake, so it stays. unit_diff is a command-line filter to diff expected results from actual results and allow you to quickly see exactly what is wrong. autotest is a continous testing facility meant to be used during development. As soon as you save a file, autotest will run the corresponding dependent tests. multiruby runs anything you want on multiple versions of ruby. Great for compatibility checking! Use multiruby_setup to manage your installed versions."
38
+ email:
39
+ - ryand-ruby@zenspider.com
40
+ - drbrain@segment7.net
41
+ - asari.ruby@gmail.com
42
+ executables:
43
+ - autotest
44
+ - multigem
45
+ - multiruby
46
+ - multiruby_setup
47
+ - unit_diff
48
+ - zentest
49
+ extensions: []
50
+
51
+ extra_rdoc_files:
52
+ - History.txt
53
+ - Manifest.txt
54
+ - README.txt
55
+ - articles/how_to_use_zentest.txt
56
+ - example.txt
57
+ files:
58
+ - .autotest
59
+ - History.txt
60
+ - Manifest.txt
61
+ - README.txt
62
+ - Rakefile
63
+ - articles/Article.css
64
+ - articles/getting_started_with_autotest.html
65
+ - articles/how_to_use_zentest.txt
66
+ - bin/autotest
67
+ - bin/multigem
68
+ - bin/multiruby
69
+ - bin/multiruby_setup
70
+ - bin/unit_diff
71
+ - bin/zentest
72
+ - example.txt
73
+ - example1.rb
74
+ - example2.rb
75
+ - example_dot_autotest.rb
76
+ - lib/autotest.rb
77
+ - lib/autotest/autoupdate.rb
78
+ - lib/autotest/once.rb
79
+ - lib/autotest/rcov.rb
80
+ - lib/autotest/restart.rb
81
+ - lib/autotest/timestamp.rb
82
+ - lib/focus.rb
83
+ - lib/functional_test_matrix.rb
84
+ - lib/multiruby.rb
85
+ - lib/unit_diff.rb
86
+ - lib/zentest.rb
87
+ - lib/zentest_mapping.rb
88
+ - test/test_autotest.rb
89
+ - test/test_focus.rb
90
+ - test/test_unit_diff.rb
91
+ - test/test_zentest.rb
92
+ - test/test_zentest_mapping.rb
93
+ has_rdoc: false
94
+ homepage: http://www.zenspider.com/ZSS/Products/ZenTest/
95
+ licenses:
96
+ post_install_message:
97
+ rdoc_options:
98
+ - --main
99
+ - README.txt
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: "0"
107
+ version:
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: "0"
113
+ version:
114
+ requirements: []
115
+
116
+ rubyforge_project: zentest
117
+ rubygems_version: 1.3.5
118
+ signing_key:
119
+ specification_version: 3
120
+ summary: "ZenTest provides 4 different tools: zentest, unit_diff, autotest, and multiruby"
121
+ test_files:
122
+ - test/test_autotest.rb
123
+ - test/test_focus.rb
124
+ - test/test_unit_diff.rb
125
+ - test/test_zentest.rb
126
+ - test/test_zentest_mapping.rb