m 1.4.0 → 1.6.0

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.
@@ -1,3 +1,4 @@
1
+ require 'active_support'
1
2
  require 'active_support/test_case'
2
3
 
3
4
  class MultipleExampleTest < ActiveSupport::TestCase
@@ -0,0 +1,7 @@
1
+ require_relative '../../../test_helper'
2
+
3
+ class DTest < MTest
4
+ def test_d
5
+ assert_equal 1, 1
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ require_relative '../../../../test_helper'
2
+
3
+ class ETest < MTest
4
+ def test_e
5
+ assert_equal 1, 1
6
+ end
7
+ end
@@ -0,0 +1,33 @@
1
+ require "test_helper"
2
+
3
+ class ExitCodesTest < MTest
4
+ def test_failing_test_returns_1
5
+ m("examples/subdir_with_failures/a_test")
6
+ refute $?.success?, "expected exit code to be 1 but it was #{$?.exitstatus}"
7
+ end
8
+
9
+ def test_test_with_error_returns_1
10
+ m("../lib/error_tests/error_test")
11
+ refute $?.success?, "expected exit code to be 1 but it was #{$?.exitstatus}"
12
+ end
13
+
14
+ def test_dir_with_failure_returns_1
15
+ m("examples/subdir_with_failures")
16
+ refute $?.success?, "expected exit code to be 1 but it was #{$?.exitstatus}"
17
+ end
18
+
19
+ def test_dir_with_error_returns_1
20
+ m("../lib/error_tests")
21
+ refute $?.success?, "expected exit code to be 1 but it was #{$?.exitstatus}"
22
+ end
23
+
24
+ def test_without_errors_or_failures_returns_0
25
+ m("examples/subdir/a_test")
26
+ assert $?.success?, "expected exit code to be 0 but it was #{$?.exitstatus}"
27
+ end
28
+
29
+ def test_dir_without_errors_or_failures_returns_0
30
+ m("examples/subdir")
31
+ assert $?.success?, "expected exit code to be 0 but it was #{$?.exitstatus}"
32
+ end
33
+ end
@@ -3,16 +3,16 @@ require 'test_helper'
3
3
  class MultipleTest < MTest
4
4
  def test_run_simple_test_by_line_number
5
5
  output = m('examples/multiple_example_test.rb:11')
6
- assert_output(/1 tests, 1 assertions/, output)
6
+ assert_output(/1 (runs|tests), 1 assertions/, output)
7
7
  end
8
8
 
9
9
  def test_runs_entire_test_without_line_number
10
10
  output = m('examples/multiple_example_test.rb')
11
- assert_output(/4 tests/, output)
11
+ assert_output(/4 (runs|tests)/, output)
12
12
  end
13
13
 
14
14
  def test_runs_all_tests_on_given_line_number
15
15
  output = m('examples/multiple_example_test.rb:6')
16
- assert_output(/3 tests/, output)
16
+ assert_output(/3 (runs|tests)/, output)
17
17
  end
18
18
  end
data/test/options_test.rb CHANGED
@@ -17,17 +17,49 @@ class OptionsTest < MTest
17
17
  end
18
18
 
19
19
  def test_short_line_option
20
- output = m('-l20 examples/minitest_4_example_test.rb')
21
- assert_output(/1 tests, 1 assertions/, output)
20
+ output = m('-l20 examples/minitest_example_test.rb')
21
+ assert_output(/1 (runs|tests), 1 assertions/, output)
22
22
  end
23
23
 
24
24
  def test_long_line_option
25
- output = m('--line 20 examples/minitest_4_example_test.rb')
26
- assert_output(/1 tests, 1 assertions/, output)
25
+ output = m('--line 20 examples/minitest_example_test.rb')
26
+ assert_output(/1 (runs|tests), 1 assertions/, output)
27
27
  end
28
28
 
29
29
  def test_line_option_has_precedence_over_colon_format
30
- output = m('--line 20 examples/minitest_4_example_test.rb:2')
31
- assert_output(/1 tests, 1 assertions/, output)
30
+ output = m('--line 20 examples/minitest_example_test.rb:2')
31
+ assert_output(/1 (runs|tests), 1 assertions/, output)
32
+ end
33
+
34
+ def test_recursive_option
35
+ output = m('-r examples/subdir')
36
+ assert_output(/5 (runs|tests)/, output)
37
+ end
38
+
39
+ def test_recursive_option_without_directory_arg_fails
40
+ output = m('-r')
41
+ assert_match(/OptionParser::MissingArgument/, output)
42
+ end
43
+
44
+ def test_passthrough_options
45
+ output = m('-- --verbose')
46
+ assert_output(/0 errors/, output)
47
+ end
48
+
49
+ def test_passthrough_options_name_with_file
50
+ output = m('examples/minitest_example_test.rb -- --name /test_that_it_will_not_blend/')
51
+ assert_output(/1 (runs|tests)/, output)
52
+ assert_output(/0 failures/, output)
53
+ assert_output(/0 errors/, output)
54
+ end
55
+
56
+ def test_passthrough_options_with_file
57
+ output = m('examples/minitest_example_test.rb -- --verbose')
58
+ assert_output(/3 (runs|tests), 9 assertions/, output)
59
+ end
60
+
61
+ def test_passthrough_options_with_file_and_other_options
62
+ output = m('--line 20 examples/minitest_example_test.rb -- --verbose')
63
+ assert_output(/1 (runs|tests), 1 assertions/, output)
32
64
  end
33
65
  end
data/test/test_helper.rb CHANGED
@@ -16,6 +16,11 @@ module Testable
16
16
  assert $?.success?, "Execution failed, output:\n\n#{output}"
17
17
  assert_match regexp, output
18
18
  end
19
+
20
+ def assert_output_for_failed_execution(regexp, output)
21
+ refute $?.success?, "Execution did not fail, but it should"
22
+ assert_match regexp, output
23
+ end
19
24
  end
20
25
 
21
26
  require 'm'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: m
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Quaranto
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-27 00:00:00.000000000 Z
11
+ date: 2021-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: method_source
@@ -120,6 +120,7 @@ files:
120
120
  - gemfiles/minitest5.gemfile.lock
121
121
  - gemfiles/test_unit_gem.gemfile
122
122
  - gemfiles/test_unit_gem.gemfile.lock
123
+ - lib/error_tests/error_test.rb
123
124
  - lib/m.rb
124
125
  - lib/m/executor.rb
125
126
  - lib/m/frameworks.rb
@@ -133,7 +134,7 @@ files:
133
134
  - lib/m/test_collection.rb
134
135
  - lib/m/test_method.rb
135
136
  - lib/m/testable.rb
136
- - lib/version.rb
137
+ - lib/m/version.rb
137
138
  - m.gemspec
138
139
  - rush.jpg
139
140
  - test/Rakefile
@@ -147,12 +148,16 @@ files:
147
148
  - test/examples/empty_example_test.rb
148
149
  - test/examples/minitest_4_example_test.rb
149
150
  - test/examples/minitest_5_example_test.rb
151
+ - test/examples/minitest_example_test.rb
150
152
  - test/examples/multiple_example_test.rb
151
153
  - test/examples/subdir/a_test.rb
154
+ - test/examples/subdir/another_subdir/d_test.rb
155
+ - test/examples/subdir/another_subdir/yet_another_subdir/e_test.rb
152
156
  - test/examples/subdir/b_test.rb
153
157
  - test/examples/subdir/c_test.rb
154
158
  - test/examples/subdir_with_failures/a_test.rb
155
159
  - test/examples/test_unit_example_test.rb
160
+ - test/exit_codes_test.rb
156
161
  - test/minitest_4_test.rb
157
162
  - test/minitest_5_test.rb
158
163
  - test/multiple_test.rb
@@ -162,7 +167,7 @@ files:
162
167
  homepage: https://github.com/qrush/m
163
168
  licenses: []
164
169
  metadata: {}
165
- post_install_message:
170
+ post_install_message:
166
171
  rdoc_options: []
167
172
  require_paths:
168
173
  - lib
@@ -177,9 +182,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
182
  - !ruby/object:Gem::Version
178
183
  version: '0'
179
184
  requirements: []
180
- rubyforge_project:
181
- rubygems_version: 2.4.8
182
- signing_key:
185
+ rubygems_version: 3.2.27
186
+ signing_key:
183
187
  specification_version: 4
184
188
  summary: Run test/unit tests by line number. Metal!
185
189
  test_files:
@@ -194,12 +198,16 @@ test_files:
194
198
  - test/examples/empty_example_test.rb
195
199
  - test/examples/minitest_4_example_test.rb
196
200
  - test/examples/minitest_5_example_test.rb
201
+ - test/examples/minitest_example_test.rb
197
202
  - test/examples/multiple_example_test.rb
198
203
  - test/examples/subdir/a_test.rb
204
+ - test/examples/subdir/another_subdir/d_test.rb
205
+ - test/examples/subdir/another_subdir/yet_another_subdir/e_test.rb
199
206
  - test/examples/subdir/b_test.rb
200
207
  - test/examples/subdir/c_test.rb
201
208
  - test/examples/subdir_with_failures/a_test.rb
202
209
  - test/examples/test_unit_example_test.rb
210
+ - test/exit_codes_test.rb
203
211
  - test/minitest_4_test.rb
204
212
  - test/minitest_5_test.rb
205
213
  - test/multiple_test.rb
data/lib/version.rb DELETED
@@ -1,3 +0,0 @@
1
- module M
2
- VERSION = "1.4.0"
3
- end