m 1.3.2 → 1.3.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3efd4703305185d77843c0e1ff989b5bba779623
4
- data.tar.gz: bf67627cd38f704f25923468e778e5ba895dfd1d
3
+ metadata.gz: dbd933c0fe3a41a288037d2a8b1a6c3bec5f60b7
4
+ data.tar.gz: d9bfa2b3ba294b898407a2a053556dd8b18d3855
5
5
  SHA512:
6
- metadata.gz: 83a0e3b89f2d8419623ac488cbda1c937b538d1f6cf253a20761eed76c59b26c271b54be207e9779d0308270e20d7b40962cbd33591222e62edf440f26ef98b1
7
- data.tar.gz: ec35bf3a0a0ff0dfcf763fdfe9b87d069eeb1d7cc2a039c800b60cdeb1de9c7acacf7bfa2b8a3c1eedc7144ffdf266c721a3162d0ee2d1b952162c888c325296
6
+ metadata.gz: db5ce32d613f9edaf57001b2dcec827fd8465d5c89fc55f551f7e211cf43bd7eea38a321b53d5b1d7556dace9ef62675f69cfb03c5fb68d90699b427256de742
7
+ data.tar.gz: e1d13b7da917f7fcbf7df78ec20a11b10af5cd7131c4f5cb44c8b9b0c6aa0a3ba93e13ac2b236fcfd2f304dd2684e75594de8b08cc5efe9357cb2740e5d5841d
@@ -1,5 +1,6 @@
1
1
  rvm:
2
2
  - 1.9.3
3
+ - 2.0.0
3
4
  branches:
4
5
  only:
5
6
  - master
@@ -0,0 +1,7 @@
1
+ appraise "minitest4" do
2
+ gem 'minitest', '4.7.5'
3
+ end
4
+
5
+ appraise "minitest5" do
6
+ gem 'minitest'
7
+ end
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem 'coveralls', require: false
4
+
3
5
  gemspec
@@ -0,0 +1,146 @@
1
+ M.RB
2
+ ----
3
+
4
+ `m` stands for metal, a better test/unit test runner that can run tests by line number.
5
+
6
+ ________________________________________________________________________________
7
+ _________________________/\\\\____________/\\\\_________________________________
8
+ _________________________\/\\\\\\________/\\\\\\________________________________
9
+ __________________________\/\\\//\\\____/\\\//\\\_______________________________
10
+ ___________________________\/\\\\///\\\/\\\/_\/\\\______________________________
11
+ ____________________________\/\\\__\///\\\/___\/\\\_____________________________
12
+ _____________________________\/\\\____\///_____\/\\\____________________________
13
+ ______________________________\/\\\_____________\/\\\___________________________
14
+ _______________________________\/\\\_____________\/\\\__________________________
15
+ ________________________________\///______________\///__________________________
16
+ ________________________________________________________________________________
17
+
18
+
19
+ - [![Gem Version](https://badge.fury.io/rb/m.png)](https://rubygems.org/gems/m)
20
+ - [![Code Climate](https://codeclimate.com/github/qrush/m.png)](https://codeclimate.com/github/qrush/m)
21
+ - [![Build Status](https://travis-ci.org/qrush/m.png)](https://travis-ci.org/qrush/m)
22
+ - [![Dependency Status](https://gemnasium.com/qrush/m.png)](https://gemnasium.com/qrush/m)
23
+ - [![Coverage Status](https://coveralls.io/repos/qrush/m/badge.png?branch=master)](https://coveralls.io/r/qrush/m)
24
+
25
+
26
+ INSTALL
27
+ =======
28
+
29
+ Install via:
30
+
31
+
32
+ $ gem install m
33
+
34
+
35
+ If you’re using Bundler, you’ll need to include it in your Gemfile. Toss it into the test group:
36
+
37
+ ``` ruby
38
+ group :test do
39
+ gem 'm', '~> 1.3.1'
40
+ end
41
+ ```
42
+
43
+ Developing a RubyGem? Add m as a development dependency.
44
+
45
+
46
+ ``` ruby
47
+ Gem::Specification.new do |gem|
48
+ # ...
49
+ gem.add_development_dependency "m", "~> 1.3.1"
50
+ end
51
+ ```
52
+
53
+ m works on Ruby 1.9+ only.
54
+
55
+
56
+ USAGE
57
+ =====
58
+
59
+ Basically, I was sick of using the -n flag to grab one test to run. Instead, I prefer how RSpec’s test runner allows tests to be run by line number.
60
+
61
+ Given this file:
62
+
63
+
64
+ $ cat -n test/example_test.rb
65
+ 1 require 'test/unit'
66
+ 2
67
+ 3 class ExampleTest < Test::Unit::TestCase
68
+ 4 def test_apple
69
+ 5 assert_equal 1, 1
70
+ 6 end
71
+ 7
72
+ 8 def test_banana
73
+ 9 assert_equal 1, 1
74
+ 10 end
75
+ 11 end
76
+
77
+
78
+ You can run a test by line number, using format m TEST_FILE:LINE_NUMBER_OF_TEST:
79
+
80
+
81
+ $ m test/example_test.rb:4
82
+ Run options: -n /test_apple/
83
+
84
+ # Running tests:
85
+
86
+ .
87
+
88
+ Finished tests in 0.000525s, 1904.7619 tests/s, 1904.7619 assertions/s.
89
+
90
+ 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
91
+
92
+
93
+ Hit the wrong line number? No problem, m helps you out:
94
+
95
+
96
+ $ m test/example_test.rb:2
97
+ No tests found on line 2. Valid tests to run:
98
+
99
+ test_apple: m test/examples/test_unit_example_test.rb:4
100
+ test_banana: m test/examples/test_unit_example_test.rb:8
101
+
102
+
103
+ Want to run the whole test? Just leave off the line number.
104
+
105
+
106
+ $ m test/example_test.rb
107
+ Run options:
108
+
109
+ # Running tests:
110
+
111
+ ..
112
+
113
+ Finished tests in 0.001293s, 1546.7904 tests/s, 3093.5808 assertions/s.
114
+
115
+ 1 tests, 2 assertions, 0 failures, 0 errors, 0 skips
116
+
117
+
118
+ SUPPORT
119
+ =======
120
+
121
+ `m` works with a few Ruby test frameworks:
122
+
123
+ - Test::Unit
124
+ - ActiveSupport::TestCase
125
+ - MiniTest::Unit::TestCase
126
+
127
+
128
+ CONTRIBUTING
129
+ ============
130
+
131
+ You can run the tests for minitest 4 with:
132
+
133
+ rake appraisal:minitest4 test
134
+
135
+ and the ones for minitest 5 with:
136
+
137
+ rake appraisal:minitest5 test TEST=test/minitest_5_test.rb
138
+
139
+ In the case of minitest 5 the whole suite will fail due to incompatibilities
140
+ with ruby (at least until 2.1.1).
141
+
142
+
143
+ LICENSE
144
+ =======
145
+
146
+ This gem is MIT licensed, please see LICENSE for more information.
data/Rakefile CHANGED
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env rake
2
+ require 'rubygems'
3
+ require 'bundler/setup'
4
+ require 'appraisal'
2
5
  require "bundler/gem_tasks"
3
6
  require 'rake/clean'
4
7
  require "rake/testtask"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "coveralls", :require=>false
6
+ gem "minitest", "4.7.5"
7
+
8
+ gemspec :path=>"../"
@@ -0,0 +1,64 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ m (1.3.2)
5
+ method_source (>= 0.6.7)
6
+ rake (>= 0.9.2.2)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (4.0.2)
12
+ i18n (~> 0.6, >= 0.6.4)
13
+ minitest (~> 4.2)
14
+ multi_json (~> 1.3)
15
+ thread_safe (~> 0.1)
16
+ tzinfo (~> 0.3.37)
17
+ appraisal (0.5.2)
18
+ bundler
19
+ rake
20
+ atomic (1.1.14)
21
+ colorize (0.6.0)
22
+ coveralls (0.5.8)
23
+ colorize
24
+ json
25
+ rest-client
26
+ simplecov (>= 0.7)
27
+ thor
28
+ docile (1.1.1)
29
+ i18n (0.6.9)
30
+ json (1.8.1)
31
+ method_source (0.8.2)
32
+ mime-types (2.0)
33
+ minitest (4.7.5)
34
+ multi_json (1.8.4)
35
+ mustache (0.99.4)
36
+ rake (10.1.1)
37
+ rdiscount (1.6.8)
38
+ redcarpet (3.0.0)
39
+ rest-client (1.6.7)
40
+ mime-types (>= 1.16)
41
+ rocco (0.8.2)
42
+ mustache
43
+ redcarpet
44
+ simplecov (0.8.2)
45
+ docile (~> 1.1.0)
46
+ multi_json
47
+ simplecov-html (~> 0.8.0)
48
+ simplecov-html (0.8.0)
49
+ thor (0.18.1)
50
+ thread_safe (0.1.3)
51
+ atomic
52
+ tzinfo (0.3.38)
53
+
54
+ PLATFORMS
55
+ ruby
56
+
57
+ DEPENDENCIES
58
+ activesupport
59
+ appraisal
60
+ coveralls
61
+ m!
62
+ minitest (= 4.7.5)
63
+ rdiscount
64
+ rocco
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "coveralls", :require=>false
6
+ gem "minitest"
7
+
8
+ gemspec :path=>"../"
@@ -0,0 +1,57 @@
1
+ PATH
2
+ remote: ../
3
+ specs:
4
+ m (1.3.3)
5
+ method_source (>= 0.6.7)
6
+ rake (>= 0.9.2.2)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (3.2.16)
12
+ i18n (~> 0.6, >= 0.6.4)
13
+ multi_json (~> 1.0)
14
+ appraisal (0.5.2)
15
+ bundler
16
+ rake
17
+ colorize (0.6.0)
18
+ coveralls (0.5.8)
19
+ colorize
20
+ json
21
+ rest-client
22
+ simplecov (>= 0.7)
23
+ thor
24
+ docile (1.1.1)
25
+ i18n (0.6.9)
26
+ json (1.8.1)
27
+ method_source (0.8.2)
28
+ mime-types (2.0)
29
+ minitest (5.3.1)
30
+ multi_json (1.8.4)
31
+ mustache (0.99.4)
32
+ rake (10.1.1)
33
+ rdiscount (1.6.8)
34
+ redcarpet (3.0.0)
35
+ rest-client (1.6.7)
36
+ mime-types (>= 1.16)
37
+ rocco (0.8.2)
38
+ mustache
39
+ redcarpet
40
+ simplecov (0.8.2)
41
+ docile (~> 1.1.0)
42
+ multi_json
43
+ simplecov-html (~> 0.8.0)
44
+ simplecov-html (0.8.0)
45
+ thor (0.18.1)
46
+
47
+ PLATFORMS
48
+ ruby
49
+
50
+ DEPENDENCIES
51
+ activesupport
52
+ appraisal
53
+ coveralls
54
+ m!
55
+ minitest
56
+ rdiscount
57
+ rocco
data/lib/m.rb CHANGED
@@ -95,9 +95,10 @@
95
95
 
96
96
  ### M, your metal test runner
97
97
  # Maybe this gem should have a longer name? Metal?
98
- module M
99
- VERSION = "1.3.2" unless defined?(VERSION)
98
+ require_relative 'version'
99
+ require_relative 'm/frameworks'
100
100
 
101
+ module M
101
102
  # Accept arguments coming from bin/m and run tests, then bail out immediately.
102
103
  def self.run(argv)
103
104
  # sync output since we're going to exit hard and fast
@@ -183,13 +184,15 @@ module M
183
184
  # If we found any tests,
184
185
  if tests_to_run.size > 0
185
186
  # assemble the regexp to run these tests,
186
- test_names = tests_to_run.map(&:name).join('|')
187
+ test_names = tests_to_run.map { |test| Regexp.escape(test.name) }.join('|')
187
188
 
188
189
  # set up the args needed for the runner
189
- test_arguments = ["-n", "/(#{test_names})/"]
190
+ test_arguments = ["-n", "/^(#{test_names})$/"]
190
191
 
191
192
  # directly run the tests from here and exit with the status of the tests passing or failing
192
- if defined?(MiniTest)
193
+ if Frameworks.minitest5?
194
+ Minitest.run test_arguments
195
+ elsif Frameworks.minitest4?
193
196
  MiniTest::Unit.runner.run test_arguments
194
197
  elsif defined?(Test)
195
198
  Test::Unit::AutoRunner.run(false, nil, test_arguments)
@@ -209,6 +212,11 @@ module M
209
212
  # Spit out helpful message and bail
210
213
  STDERR.puts message
211
214
  false
215
+ else
216
+ # There were no tests at all
217
+ message = "There were no tests found.\n\n"
218
+ STDERR.puts message
219
+ false
212
220
  end
213
221
  end
214
222
 
@@ -227,7 +235,9 @@ module M
227
235
  end
228
236
 
229
237
  # Figure out what test framework we're using
230
- if defined?(MiniTest)
238
+ if Frameworks.minitest5?
239
+ suites = Minitest::Runnable.runnables
240
+ elsif Frameworks.minitest4?
231
241
  suites = MiniTest::Unit::TestCase.test_suites
232
242
  elsif defined?(Test)
233
243
  suites = Test::Unit::TestCase.test_suites
@@ -239,7 +249,11 @@ module M
239
249
  # Use some janky internal APIs to group test methods by test suite.
240
250
  suites.inject({}) do |suites, suite_class|
241
251
  # End up with a hash of suite class name to an array of test methods, so we can later find them and ignore empty test suites
242
- suites[suite_class] = suite_class.test_methods if suite_class.test_methods.size > 0
252
+ if Frameworks.minitest5?
253
+ suites[suite_class] = suite_class.runnable_methods if suite_class.runnable_methods.size > 0
254
+ else
255
+ suites[suite_class] = suite_class.test_methods if suite_class.test_methods.size > 0
256
+ end
243
257
  suites
244
258
  end
245
259
  end
@@ -0,0 +1,11 @@
1
+ module M
2
+ class Frameworks
3
+ def self.minitest5?
4
+ defined?(Minitest) && Minitest::Unit::VERSION.start_with?("5")
5
+ end
6
+
7
+ def self.minitest4?
8
+ defined?(MiniTest)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module M
2
+ VERSION = "1.3.3"
3
+ end
data/m.gemspec CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.add_development_dependency "rdiscount"
19
19
  gem.add_development_dependency "rocco"
20
20
  gem.add_development_dependency "minitest"
21
+ gem.add_development_dependency "appraisal"
21
22
 
22
23
  gem.required_ruby_version = ">= 1.9"
23
24
 
@@ -45,4 +45,9 @@ EOF
45
45
  output = m('examples/active_support_example_test.rb:22')
46
46
  assert_output /1 tests, 1 assertions/, output
47
47
  end
48
+
49
+ def test_run_on_test_with_unescaped_regular_express_characters
50
+ output = m('examples/active_support_unescaped_example_test.rb:8')
51
+ assert_output /1 tests, 1 assertions/, output
52
+ end
48
53
  end
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ class EmptyTest < MTest
4
+ def test_run_simple_test_by_line_number
5
+ output = m('examples/empty_example_test.rb')
6
+ assert !$?.success?
7
+ assert_match /There were no tests found./, output
8
+ end
9
+ end
@@ -3,7 +3,7 @@ require 'test_helper'
3
3
  class EverythingTest < MTest
4
4
  def test_runs_entire_test_suite_with_no_arguments
5
5
  output = m('')
6
- assert_output /12 tests/, output
6
+ assert_output /14 tests/, output
7
7
  end
8
8
 
9
9
  def test_missing_file_gives_a_decent_error_message
@@ -18,7 +18,7 @@ class EverythingTest < MTest
18
18
  assert_output /3 tests/, output
19
19
 
20
20
  output = m('examples')
21
- assert_output /12 tests/, output
21
+ assert_output /14 tests/, output
22
22
  end
23
23
 
24
24
  def test_blank_file_is_quieter
@@ -0,0 +1,11 @@
1
+ require 'test/unit'
2
+ require 'active_support/test_case'
3
+
4
+ class ActiveSupportExampleTest < ActiveSupport::TestCase
5
+ setup do
6
+ end
7
+
8
+ test "#assert_equal compares to objects (and ensures they are equal)" do
9
+ assert_equal 1, 1
10
+ end
11
+ end
@@ -0,0 +1,4 @@
1
+ require 'test/unit'
2
+
3
+ class EmptyExampleTest < Test::Unit::TestCase
4
+ end
@@ -0,0 +1,36 @@
1
+ require 'minitest/unit'
2
+ if M::Frameworks.minitest4?
3
+
4
+ class Meme
5
+ def i_can_has_cheezburger?
6
+ "OHAI!"
7
+ end
8
+
9
+ def will_it_blend?
10
+ "YES!"
11
+ end
12
+ end
13
+
14
+
15
+ class TestMeme < MiniTest::Unit::TestCase
16
+ def setup
17
+ @meme = Meme.new
18
+ end
19
+
20
+ def test_that_kitty_can_eat
21
+ assert_equal "OHAI!", @meme.i_can_has_cheezburger?
22
+ end
23
+
24
+ def test_that_it_will_not_blend
25
+ refute_match /^maybe/i, @meme.will_it_blend?
26
+ refute_match /^no/i, @meme.will_it_blend?
27
+ refute_match /^lolz/i, @meme.will_it_blend?
28
+ end
29
+
30
+ def test_that_kitty_can_eat_two_time
31
+ assert_equal "OHAI!", @meme.i_can_has_cheezburger?
32
+ assert_equal "OHAI!", @meme.i_can_has_cheezburger?
33
+ end
34
+
35
+ end
36
+ end
@@ -0,0 +1,35 @@
1
+ require 'minitest/autorun'
2
+ if M::Frameworks.minitest5?
3
+ class Meme
4
+ def i_can_has_cheezburger?
5
+ "OHAI!"
6
+ end
7
+
8
+ def will_it_blend?
9
+ "YES!"
10
+ end
11
+ end
12
+
13
+
14
+ class TestMeme < Minitest::Test
15
+ def setup
16
+ @meme = Meme.new
17
+ end
18
+
19
+ def test_that_kitty_can_eat
20
+ assert_equal "OHAI!", @meme.i_can_has_cheezburger?
21
+ end
22
+
23
+ def test_that_it_will_not_blend
24
+ refute_match /^maybe/i, @meme.will_it_blend?
25
+ refute_match /^no/i, @meme.will_it_blend?
26
+ refute_match /^lolz/i, @meme.will_it_blend?
27
+ end
28
+
29
+ def test_that_kitty_can_eat_two_time
30
+ assert_equal "OHAI!", @meme.i_can_has_cheezburger?
31
+ assert_equal "OHAI!", @meme.i_can_has_cheezburger?
32
+ end
33
+
34
+ end
35
+ end
@@ -0,0 +1,39 @@
1
+ require 'test_helper'
2
+ if M::Frameworks.minitest4?
3
+
4
+ class Minitest4Test < MTest
5
+ def test_run_simple_test_by_line_number
6
+ output = m('examples/minitest_4_example_test.rb:20')
7
+ assert_output /1 tests, 1 assertions/, output
8
+ end
9
+
10
+ def test_runs_entire_test_without_line_number
11
+ output = m('examples/minitest_4_example_test.rb')
12
+ assert_output /3 tests/, output
13
+ end
14
+
15
+ def test_run_inside_of_test
16
+ output = m('examples/minitest_4_example_test.rb:21')
17
+ assert_output /1 tests, 1 assertions/, output
18
+ end
19
+
20
+ def test_run_on_end_of_test
21
+ output = m('examples/minitest_4_example_test.rb:22')
22
+ assert_output /1 tests, 1 assertions/, output
23
+ end
24
+
25
+ def test_run_inside_big_test
26
+ output = m('examples/minitest_4_example_test.rb:26')
27
+ assert_output /1 tests, 6 assertions/, output
28
+ end
29
+
30
+ def test_run_on_blank_line
31
+ output = m('examples/minitest_4_example_test.rb:3')
32
+
33
+ assert !$?.success?
34
+ assert_match /No tests found on line 3. Valid tests to run:/, output
35
+ assert_match %r{ test_that_kitty_can_eat: m examples/minitest_4_example_test\.rb:20}, output
36
+ assert_match %r{test_that_it_will_not_blend: m examples/minitest_4_example_test\.rb:24}, output
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,38 @@
1
+ require 'test_helper'
2
+ if M::Frameworks.minitest5?
3
+ class Minitest5Test < MTest
4
+ def test_run_simple_test_by_line_number
5
+ output = m('examples/minitest_5_example_test.rb:19')
6
+ assert_output /1 runs, 1 assertions/, output
7
+ end
8
+
9
+ def test_runs_entire_test_without_line_number
10
+ output = m('examples/minitest_5_example_test.rb')
11
+ assert_output /3 runs/, output
12
+ end
13
+
14
+ def test_run_inside_of_test
15
+ output = m('examples/minitest_5_example_test.rb:20')
16
+ assert_output /1 runs, 1 assertions/, output
17
+ end
18
+
19
+ def test_run_on_end_of_test
20
+ output = m('examples/minitest_5_example_test.rb:21')
21
+ assert_output /1 runs, 1 assertions/, output
22
+ end
23
+
24
+ def test_run_inside_big_test
25
+ output = m('examples/minitest_5_example_test.rb:26')
26
+ assert_output /1 runs, 6 assertions/, output
27
+ end
28
+
29
+ def test_run_on_blank_line
30
+ output = m('examples/minitest_5_example_test.rb:3')
31
+
32
+ assert !$?.success?
33
+ assert_match /No tests found on line 3. Valid tests to run:/, output
34
+ assert_match %r{ test_that_kitty_can_eat: m examples/minitest_5_example_test\.rb:19}, output
35
+ assert_match %r{test_that_it_will_not_blend: m examples/minitest_5_example_test\.rb:23}, output
36
+ end
37
+ end
38
+ end
@@ -17,17 +17,17 @@ class OptionsTest < MTest
17
17
  end
18
18
 
19
19
  def test_short_line_option
20
- output = m('-l19 examples/minitest_example_test.rb')
20
+ output = m('-l20 examples/minitest_4_example_test.rb')
21
21
  assert_output /1 tests, 1 assertions/, output
22
22
  end
23
23
 
24
24
  def test_long_line_option
25
- output = m('--line 19 examples/minitest_example_test.rb')
25
+ output = m('--line 20 examples/minitest_4_example_test.rb')
26
26
  assert_output /1 tests, 1 assertions/, output
27
27
  end
28
28
 
29
29
  def test_line_option_has_precedence_over_colon_format
30
- output = m('--line 19 examples/minitest_example_test.rb:2')
30
+ output = m('--line 20 examples/minitest_4_example_test.rb:2')
31
31
  assert_output /1 tests, 1 assertions/, output
32
32
  end
33
33
  end
@@ -1,8 +1,10 @@
1
- require './lib/m'
2
- require 'test/unit'
3
- require 'active_support/test_case'
1
+ if ENV['TRAVIS']
2
+ require 'coveralls'
3
+
4
+ Coveralls.wear!
5
+ end
4
6
 
5
- class MTest < Test::Unit::TestCase
7
+ module Testable
6
8
  def m(arguments)
7
9
  Dir.chdir("test") do
8
10
  `ruby -I../lib -I. ../bin/m #{arguments} 2>&1`.strip
@@ -14,3 +16,18 @@ class MTest < Test::Unit::TestCase
14
16
  assert_match regexp, output
15
17
  end
16
18
  end
19
+
20
+ require './lib/m'
21
+ require 'minitest/autorun'
22
+ if M::Frameworks.minitest5?
23
+ class MTest < Minitest::Test
24
+ include ::Testable
25
+ end
26
+ else
27
+ require 'test/unit'
28
+ require 'active_support/test_case'
29
+
30
+ class MTest < Test::Unit::TestCase
31
+ include ::Testable
32
+ end
33
+ end
metadata CHANGED
@@ -1,97 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: m
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Quaranto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-20 00:00:00.000000000 Z
11
+ date: 2015-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: method_source
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.6.7
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.6.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.9.2.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.9.2.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activesupport
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rdiscount
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rocco
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: minitest
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: appraisal
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  description:
@@ -102,31 +116,43 @@ executables:
102
116
  extensions: []
103
117
  extra_rdoc_files: []
104
118
  files:
105
- - .gitignore
106
- - .travis.yml
119
+ - ".gitignore"
120
+ - ".travis.yml"
121
+ - Appraisals
107
122
  - Gemfile
108
123
  - Gemfile.lock
109
124
  - LICENSE
110
- - README
125
+ - README.md
111
126
  - Rakefile
112
127
  - bin/m
128
+ - gemfiles/minitest4.gemfile
129
+ - gemfiles/minitest4.gemfile.lock
130
+ - gemfiles/minitest5.gemfile
131
+ - gemfiles/minitest5.gemfile.lock
113
132
  - lib/m.rb
133
+ - lib/m/frameworks.rb
114
134
  - lib/m/test_collection.rb
115
135
  - lib/m/test_method.rb
136
+ - lib/version.rb
116
137
  - m.gemspec
117
138
  - rush.jpg
118
139
  - test/Rakefile
119
140
  - test/active_support_test.rb
120
141
  - test/bench.rb
142
+ - test/empty_test.rb
121
143
  - test/everything_test.rb
122
144
  - test/examples/active_support_example_test.rb
123
- - test/examples/minitest_example_test.rb
145
+ - test/examples/active_support_unescaped_example_test.rb
146
+ - test/examples/empty_example_test.rb
147
+ - test/examples/minitest_4_example_test.rb
148
+ - test/examples/minitest_5_example_test.rb
124
149
  - test/examples/multiple_example_test.rb
125
150
  - test/examples/subdir/a_test.rb
126
151
  - test/examples/subdir/b_test.rb
127
152
  - test/examples/subdir/c_test.rb
128
153
  - test/examples/test_unit_example_test.rb
129
- - test/minitest_test.rb
154
+ - test/minitest_4_test.rb
155
+ - test/minitest_5_test.rb
130
156
  - test/multiple_test.rb
131
157
  - test/options_test.rb
132
158
  - test/test_helper.rb
@@ -140,34 +166,18 @@ require_paths:
140
166
  - lib
141
167
  required_ruby_version: !ruby/object:Gem::Requirement
142
168
  requirements:
143
- - - '>='
169
+ - - ">="
144
170
  - !ruby/object:Gem::Version
145
171
  version: '1.9'
146
172
  required_rubygems_version: !ruby/object:Gem::Requirement
147
173
  requirements:
148
- - - '>='
174
+ - - ">="
149
175
  - !ruby/object:Gem::Version
150
176
  version: '0'
151
177
  requirements: []
152
178
  rubyforge_project:
153
- rubygems_version: 2.0.0
179
+ rubygems_version: 2.4.5
154
180
  signing_key:
155
181
  specification_version: 4
156
182
  summary: Run test/unit tests by line number. Metal!
157
- test_files:
158
- - test/Rakefile
159
- - test/active_support_test.rb
160
- - test/bench.rb
161
- - test/everything_test.rb
162
- - test/examples/active_support_example_test.rb
163
- - test/examples/minitest_example_test.rb
164
- - test/examples/multiple_example_test.rb
165
- - test/examples/subdir/a_test.rb
166
- - test/examples/subdir/b_test.rb
167
- - test/examples/subdir/c_test.rb
168
- - test/examples/test_unit_example_test.rb
169
- - test/minitest_test.rb
170
- - test/multiple_test.rb
171
- - test/options_test.rb
172
- - test/test_helper.rb
173
- - test/test_unit_test.rb
183
+ test_files: []
data/README DELETED
@@ -1,18 +0,0 @@
1
- ________________________________________________________________________________
2
- _________________________/\\\\____________/\\\\_________________________________
3
- _________________________\/\\\\\\________/\\\\\\________________________________
4
- __________________________\/\\\//\\\____/\\\//\\\_______________________________
5
- ___________________________\/\\\\///\\\/\\\/_\/\\\______________________________
6
- ____________________________\/\\\__\///\\\/___\/\\\_____________________________
7
- _____________________________\/\\\____\///_____\/\\\____________________________
8
- ______________________________\/\\\_____________\/\\\___________________________
9
- _______________________________\/\\\_____________\/\\\__________________________
10
- ________________________________\///______________\///__________________________
11
- ________________________________________________________________________________
12
-
13
-
14
- m is a better test/unit test runner for Ruby that can run tests by
15
- line number (and more!). Please see the Rocco generated docs for
16
- more information:
17
-
18
- <http://quaran.to/m/>
@@ -1,28 +0,0 @@
1
- require 'minitest/unit'
2
-
3
- class Meme
4
- def i_can_has_cheezburger?
5
- "OHAI!"
6
- end
7
-
8
- def will_it_blend?
9
- "YES!"
10
- end
11
- end
12
-
13
-
14
- class TestMeme < MiniTest::Unit::TestCase
15
- def setup
16
- @meme = Meme.new
17
- end
18
-
19
- def test_that_kitty_can_eat
20
- assert_equal "OHAI!", @meme.i_can_has_cheezburger?
21
- end
22
-
23
- def test_that_it_will_not_blend
24
- refute_match /^maybe/i, @meme.will_it_blend?
25
- refute_match /^no/i, @meme.will_it_blend?
26
- refute_match /^lolz/i, @meme.will_it_blend?
27
- end
28
- end
@@ -1,38 +0,0 @@
1
- require 'test_helper'
2
-
3
- class MinitestTest < MTest
4
- def test_run_simple_test_by_line_number
5
- output = m('examples/minitest_example_test.rb:19')
6
- assert_output /1 tests, 1 assertions/, output
7
- end
8
-
9
- def test_runs_entire_test_without_line_number
10
- output = m('examples/minitest_example_test.rb')
11
- assert_output /2 tests/, output
12
- end
13
-
14
- def test_run_inside_of_test
15
- output = m('examples/minitest_example_test.rb:20')
16
- assert_output /1 tests, 1 assertions/, output
17
- end
18
-
19
- def test_run_on_end_of_test
20
- output = m('examples/minitest_example_test.rb:21')
21
- assert_output /1 tests, 1 assertions/, output
22
- end
23
-
24
- def test_run_inside_big_test
25
- output = m('examples/minitest_example_test.rb:25')
26
- assert_output /1 tests, 6 assertions/, output
27
- end
28
-
29
- def test_run_on_blank_line
30
- output = m('examples/minitest_example_test.rb:2')
31
-
32
- assert !$?.success?
33
- assert_match /No tests found on line 2. Valid tests to run:/, output
34
- assert_match %r{ test_that_kitty_can_eat: m examples/minitest_example_test\.rb:19}, output
35
- assert_match %r{test_that_it_will_not_blend: m examples/minitest_example_test\.rb:23}, output
36
- end
37
- end
38
-