minitest 1.7.1 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,11 @@
1
+ === 1.7.2 / 2010-09-23
2
+
3
+ * 3 bug fixes:
4
+
5
+ * Fixed doco for expectations and Spec.
6
+ * Fixed test_capture_io on 1.9.3+ (sora_h)
7
+ * assert_raises now lets MiniTest::Skip through. (shyouhei)
8
+
1
9
  === 1.7.1 / 2010-09-01
2
10
 
3
11
  * 1 bug fix:
@@ -3,7 +3,7 @@
3
3
  require 'minitest/unit'
4
4
 
5
5
  class Module
6
- def infect_an_assertion meth, new_name, dont_flip = false
6
+ def infect_an_assertion meth, new_name, dont_flip = false # :nodoc:
7
7
  # warn "%-22p -> %p %p" % [meth, new_name, dont_flip]
8
8
  self.class_eval <<-EOM
9
9
  def #{new_name} *args, &block
@@ -16,11 +16,17 @@ class Module
16
16
  EOM
17
17
  end
18
18
 
19
+ ##
20
+ # Create your own expectations from MiniTest::Assertions using a
21
+ # flexible set of rules. If you don't like must/wont, then this
22
+ # method is your friend. For an example of its usage see the bottom
23
+ # of minitest/spec.rb.
24
+
19
25
  def infect_with_assertions(pos_prefix, neg_prefix,
20
26
  skip_re,
21
27
  dont_flip_re = /\c0/,
22
28
  map = {})
23
- MiniTest::Assertions.public_instance_methods(false).each do |meth|
29
+ MiniTest::Assertions.public_instance_methods(false).sort.each do |meth|
24
30
  meth = meth.to_s
25
31
 
26
32
  new_name = case meth
@@ -35,28 +41,14 @@ class Module
35
41
  regexp, replacement = map.find { |re, _| new_name =~ re }
36
42
  new_name.sub! regexp, replacement if replacement
37
43
 
44
+ puts "\n##\n# :method: #{new_name}\n# See MiniTest::Assertions##{meth}" if
45
+ $0 == __FILE__
46
+
38
47
  infect_an_assertion meth, new_name, new_name =~ dont_flip_re
39
48
  end
40
49
  end
41
50
  end
42
51
 
43
- Object.infect_with_assertions(:must, :wont,
44
- /^(must|wont)$|wont_(throw)|
45
- must_(block|not?_|nothing|raise$)/x,
46
- /(must|wont)_(include|respond_to)/,
47
- /(must_throw)s/ => '\1',
48
- /(?!not)_same/ => '_be_same_as',
49
- /_in_/ => '_be_within_',
50
- /_operator/ => '_be',
51
- /_includes/ => '_include',
52
- /(must|wont)_(.*_of|nil|silent|empty)/ => '\1_be_\2',
53
- /must_raises/ => 'must_raise')
54
-
55
- class Object
56
- alias :must_be_close_to :must_be_within_delta
57
- alias :wont_be_close_to :wont_be_within_delta
58
- end
59
-
60
52
  module Kernel
61
53
  ##
62
54
  # Describe a series of expectations for a given target +desc+.
@@ -91,6 +83,12 @@ class Module
91
83
  end
92
84
  end
93
85
 
86
+ ##
87
+ # MiniTest::Spec -- The faster, better, less-magical spec framework!
88
+ #
89
+ # For a list of expectations, see Object.
90
+
91
+
94
92
  class MiniTest::Spec < MiniTest::Unit::TestCase
95
93
  @@describe_stack = [MiniTest::Spec]
96
94
  def self.describe_stack # :nodoc:
@@ -168,10 +166,36 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
168
166
  mod.send :undef_method, name if mod.respond_to? name
169
167
  end
170
168
  end
169
+ end
170
+
171
+ Object.infect_with_assertions(:must, :wont,
172
+ /^(must|wont)$|wont_(throw)|
173
+ must_(block|not?_|nothing|raise$)/x,
174
+ /(must|wont)_(include|respond_to)/,
175
+ /(must_throw)s/ => '\1',
176
+ /(?!not)_same/ => '_be_same_as',
177
+ /_in_/ => '_be_within_',
178
+ /_operator/ => '_be',
179
+ /_includes/ => '_include',
180
+ /(must|wont)_(.*_of|nil|silent|empty)/ => '\1_be_\2',
181
+ /must_raises/ => 'must_raise')
182
+
183
+ class Object
184
+ alias :must_be_close_to :must_be_within_delta
185
+ alias :wont_be_close_to :wont_be_within_delta
186
+
187
+ if $0 == __FILE__ then
188
+ { "must" => "assert", "wont" => "refute" }.each do |a, b|
189
+ puts "\n"
190
+ puts "##"
191
+ puts "# :method: #{a}_be_close_to"
192
+ puts "# See MiniTest::Assertions##{b}_in_delta"
193
+ end
194
+ end
171
195
 
172
196
  ##
173
197
  # :method: must_be
174
- # See MiniTest::Assertions#assert
198
+ # See MiniTest::Assertions#assert_operator
175
199
 
176
200
  ##
177
201
  # :method: must_be_close_to
@@ -239,11 +263,11 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
239
263
 
240
264
  ##
241
265
  # :method: must_throw
242
- # See MiniTest::Assertions#assert_throw
266
+ # See MiniTest::Assertions#assert_throws
243
267
 
244
268
  ##
245
269
  # :method: wont_be
246
- # See MiniTest::Assertions#refute
270
+ # See MiniTest::Assertions#refute_operator
247
271
 
248
272
  ##
249
273
  # :method: wont_be_close_to
@@ -273,10 +297,6 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
273
297
  # :method: wont_be_within_delta
274
298
  # See MiniTest::Assertions#refute_in_delta
275
299
 
276
- ##
277
- # :method: wont_be_within_delta
278
- # See MiniTest::Assertions#refute_in_delta
279
-
280
300
  ##
281
301
  # :method: wont_be_within_epsilon
282
302
  # See MiniTest::Assertions#refute_in_epsilon
@@ -216,6 +216,14 @@ module MiniTest
216
216
  begin
217
217
  yield
218
218
  should_raise = true
219
+ rescue MiniTest::Skip => e
220
+ details = "#{msg}#{mu_pp(exp)} exception expected, not"
221
+
222
+ if exp.include? MiniTest::Skip then
223
+ return e
224
+ else
225
+ raise e
226
+ end
219
227
  rescue Exception => e
220
228
  details = "#{msg}#{mu_pp(exp)} exception expected, not"
221
229
  assert(exp.any? { |ex|
@@ -255,6 +263,7 @@ module MiniTest
255
263
  # +send_ary+ is a receiver, message and arguments.
256
264
  #
257
265
  # Fails unless the call returns a true value
266
+ # TODO: I should prolly remove this from specs
258
267
 
259
268
  def assert_send send_ary, m = nil
260
269
  recv, msg, *args = send_ary
@@ -497,7 +506,7 @@ module MiniTest
497
506
  end
498
507
 
499
508
  class Unit
500
- VERSION = "1.7.1" # :nodoc:
509
+ VERSION = "1.7.2" # :nodoc:
501
510
 
502
511
  attr_accessor :report, :failures, :errors, :skips # :nodoc:
503
512
  attr_accessor :test_count, :assertion_count # :nodoc:
@@ -636,6 +636,26 @@ class TestMiniTestTestCase < MiniTest::Unit::TestCase
636
636
  end
637
637
  end
638
638
 
639
+ ##
640
+ # *sigh* This is quite an odd scenario, but it is from real (albeit
641
+ # ugly) test code in ruby-core:
642
+ #
643
+ # http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29259
644
+
645
+ def test_assert_raises_skip
646
+ @assertion_count = 0
647
+
648
+ util_assert_triggered "skipped", MiniTest::Skip do
649
+ @tc.assert_raises ArgumentError do
650
+ begin
651
+ raise "blah"
652
+ rescue
653
+ skip "skipped"
654
+ end
655
+ end
656
+ end
657
+ end
658
+
639
659
  def test_assert_raises_module
640
660
  @tc.assert_raises M do
641
661
  raise E
@@ -822,6 +842,8 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
822
842
  def test_capture_io
823
843
  @assertion_count = 0
824
844
 
845
+ orig_verbose = $VERBOSE
846
+ $VERBOSE = false
825
847
  out, err = capture_io do
826
848
  puts 'hi'
827
849
  warn 'bye!'
@@ -829,6 +851,8 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
829
851
 
830
852
  assert_equal "hi\n", out
831
853
  assert_equal "bye!\n", err
854
+ ensure
855
+ $VERBOSE = orig_verbose
832
856
  end
833
857
 
834
858
  def test_class_asserts_match_refutes
metadata CHANGED
@@ -1,53 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
5
4
  prerelease: false
6
5
  segments:
7
6
  - 1
8
7
  - 7
9
- - 1
10
- version: 1.7.1
8
+ - 2
9
+ version: 1.7.2
11
10
  platform: ruby
12
11
  authors:
13
12
  - Ryan Davis
14
13
  autorequire:
15
14
  bindir: bin
16
- cert_chain:
17
- - |
18
- -----BEGIN CERTIFICATE-----
19
- MIIDPjCCAiagAwIBAgIBADANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
20
- ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
21
- GRYDY29tMB4XDTA5MDMwNjE4NTMxNVoXDTEwMDMwNjE4NTMxNVowRTETMBEGA1UE
22
- AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
23
- JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
24
- b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
25
- taCPaLmfYIaFcHHCSY4hYDJijRQkLxPeB3xbOfzfLoBDbjvx5JxgJxUjmGa7xhcT
26
- oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
27
- GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
28
- qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
29
- gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
30
- HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
31
- AQAY59gYvDxqSqgC92nAP9P8dnGgfZgLxP237xS6XxFGJSghdz/nI6pusfCWKM8m
32
- vzjjH2wUMSSf3tNudQ3rCGLf2epkcU13/rguI88wO6MrE0wi4ZqLQX+eZQFskJb/
33
- w6x9W1ur8eR01s397LSMexySDBrJOh34cm2AlfKr/jokKCTwcM0OvVZnAutaovC0
34
- l1SVZ0ecg88bsWHA0Yhh7NFxK1utWoIhtB6AFC/+trM0FQEB/jZkIS8SaNzn96Rl
35
- n0sZEf77FLf5peR8TP/PtmIg7Cyqz23sLM4mCOoTGIy5OcZ8TdyiyINUHtb5ej/T
36
- FBHgymkyj/AOSqKRIpXPhjC6
37
- -----END CERTIFICATE-----
15
+ cert_chain: []
38
16
 
39
- date: 2010-09-01 00:00:00 -07:00
17
+ date: 2010-09-23 00:00:00 -07:00
40
18
  default_executable:
41
19
  dependencies:
42
20
  - !ruby/object:Gem::Dependency
43
21
  name: rubyforge
44
22
  prerelease: false
45
23
  requirement: &id001 !ruby/object:Gem::Requirement
46
- none: false
47
24
  requirements:
48
25
  - - ">="
49
26
  - !ruby/object:Gem::Version
50
- hash: 7
51
27
  segments:
52
28
  - 2
53
29
  - 0
@@ -59,32 +35,28 @@ dependencies:
59
35
  name: minitest
60
36
  prerelease: false
61
37
  requirement: &id002 !ruby/object:Gem::Requirement
62
- none: false
63
38
  requirements:
64
39
  - - ">="
65
40
  - !ruby/object:Gem::Version
66
- hash: 11
67
41
  segments:
68
42
  - 1
69
- - 7
43
+ - 6
70
44
  - 0
71
- version: 1.7.0
45
+ version: 1.6.0
72
46
  type: :development
73
47
  version_requirements: *id002
74
48
  - !ruby/object:Gem::Dependency
75
49
  name: hoe
76
50
  prerelease: false
77
51
  requirement: &id003 !ruby/object:Gem::Requirement
78
- none: false
79
52
  requirements:
80
53
  - - ">="
81
54
  - !ruby/object:Gem::Version
82
- hash: 21
83
55
  segments:
84
56
  - 2
85
57
  - 6
86
- - 1
87
- version: 2.6.1
58
+ - 0
59
+ version: 2.6.0
88
60
  type: :development
89
61
  version_requirements: *id003
90
62
  description: |-
@@ -133,27 +105,23 @@ rdoc_options:
133
105
  require_paths:
134
106
  - lib
135
107
  required_ruby_version: !ruby/object:Gem::Requirement
136
- none: false
137
108
  requirements:
138
109
  - - ">="
139
110
  - !ruby/object:Gem::Version
140
- hash: 3
141
111
  segments:
142
112
  - 0
143
113
  version: "0"
144
114
  required_rubygems_version: !ruby/object:Gem::Requirement
145
- none: false
146
115
  requirements:
147
116
  - - ">="
148
117
  - !ruby/object:Gem::Version
149
- hash: 3
150
118
  segments:
151
119
  - 0
152
120
  version: "0"
153
121
  requirements: []
154
122
 
155
123
  rubyforge_project: bfts
156
- rubygems_version: 1.3.7
124
+ rubygems_version: 1.3.6
157
125
  signing_key:
158
126
  specification_version: 3
159
127
  summary: minitest/unit is a small and fast replacement for ruby's huge and slow test/unit
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
@@ -1,2 +0,0 @@
1
- ^!�6$<������g��Υ� ��{D ��gS�貪-ɏES����
2
- �� @�z�g��*��Ÿ�JJ��6nO�Ik��HV��ř��sFy��k�-��_�SF�P���>S���S`]yݭ."�C;MB�oB�W��4�#��ej�6r��p�z�фW2�X����A�?��YGq&^�w�����@�����ƕ~/Z�r��T��B0B3n�zQMGŌ�̛3�����eͳ����8;4���G���#�E;��