SlimTest 4.6.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: SlimTest
3
+ version: !ruby/object:Gem::Version
4
+ version: 4.6.1.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ryan Davis
9
+ - Eric Hodel
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2011-08-12 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hoe
17
+ requirement: &2156932620 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: '2.10'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: *2156932620
26
+ description: ! 'ZenTest provides 4 different tools: zentest, unit_diff, autotest,
27
+ and
28
+
29
+ multiruby.
30
+
31
+
32
+ ZenTest scans your target and unit-test code and writes your missing
33
+
34
+ code based on simple naming rules, enabling XP at a much quicker
35
+
36
+ pace. ZenTest only works with Ruby and Test::Unit. Nobody uses this
37
+
38
+ tool anymore but it is the package namesake, so it stays.
39
+
40
+
41
+ unit_diff is a command-line filter to diff expected results from
42
+
43
+ actual results and allow you to quickly see exactly what is wrong.
44
+
45
+ Do note that minitest 2.2+ provides an enhanced assert_equal obviating
46
+
47
+ the need for unit_diff
48
+
49
+
50
+ autotest is a continous testing facility meant to be used during
51
+
52
+ development. As soon as you save a file, autotest will run the
53
+
54
+ corresponding dependent tests.
55
+
56
+
57
+ multiruby runs anything you want on multiple versions of ruby. Great
58
+
59
+ for compatibility checking! Use multiruby_setup to manage your
60
+
61
+ installed versions.'
62
+ email:
63
+ - ryand-ruby@zenspider.com
64
+ - drbrain@segment7.net
65
+ executables:
66
+ - slim-autotest
67
+ - slim-multigem
68
+ - slim-multiruby
69
+ - slim-multiruby_setup
70
+ - slim-unit_diff
71
+ - slim-zentest
72
+ extensions: []
73
+ extra_rdoc_files:
74
+ - History.txt
75
+ - Manifest.txt
76
+ - README.txt
77
+ - articles/how_to_use_zentest.txt
78
+ - example.txt
79
+ files:
80
+ - .autotest
81
+ - History.txt
82
+ - Manifest.txt
83
+ - README.txt
84
+ - Rakefile
85
+ - articles/Article.css
86
+ - articles/getting_started_with_autotest.html
87
+ - articles/how_to_use_zentest.txt
88
+ - bin/slim-autotest
89
+ - bin/slim-multigem
90
+ - bin/slim-multiruby
91
+ - bin/slim-multiruby_setup
92
+ - bin/slim-unit_diff
93
+ - bin/slim-zentest
94
+ - example.txt
95
+ - example1.rb
96
+ - example2.rb
97
+ - example_dot_autotest.rb
98
+ - lib/autotest.rb
99
+ - lib/autotest/autoupdate.rb
100
+ - lib/autotest/bundler.rb
101
+ - lib/autotest/isolate.rb
102
+ - lib/autotest/once.rb
103
+ - lib/autotest/preload.rb
104
+ - lib/autotest/rcov.rb
105
+ - lib/autotest/restart.rb
106
+ - lib/autotest/timestamp.rb
107
+ - lib/focus.rb
108
+ - lib/functional_test_matrix.rb
109
+ - lib/multiruby.rb
110
+ - lib/unit_diff.rb
111
+ - lib/zentest.rb
112
+ - lib/zentest_mapping.rb
113
+ - test/test_autotest.rb
114
+ - test/test_focus.rb
115
+ - test/test_unit_diff.rb
116
+ - test/test_zentest.rb
117
+ - test/test_zentest_mapping.rb
118
+ - .gemtest
119
+ homepage: https://github.com/seattlerb/zentest
120
+ licenses: []
121
+ post_install_message:
122
+ rdoc_options:
123
+ - --main
124
+ - README.txt
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ! '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ none: false
135
+ requirements:
136
+ - - ! '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubyforge_project: slimtest
141
+ rubygems_version: 1.8.8
142
+ signing_key:
143
+ specification_version: 3
144
+ summary: ! 'ZenTest provides 4 different tools: zentest, unit_diff, autotest, and
145
+ multiruby'
146
+ test_files:
147
+ - test/test_autotest.rb
148
+ - test/test_focus.rb
149
+ - test/test_unit_diff.rb
150
+ - test/test_zentest.rb
151
+ - test/test_zentest_mapping.rb