m 1.3.3 → 1.3.4
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 +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +8 -4
- data/Gemfile +1 -0
- data/README.md +11 -6
- data/Rakefile +10 -1
- data/benchmarks/20150430-benchmark.log +26 -0
- data/gemfiles/minitest4.gemfile +1 -1
- data/gemfiles/minitest4.gemfile.lock +30 -18
- data/gemfiles/minitest5.gemfile +1 -1
- data/gemfiles/minitest5.gemfile.lock +29 -17
- data/lib/m.rb +1 -271
- data/lib/m/executor.rb +101 -0
- data/lib/m/frameworks.rb +34 -0
- data/lib/m/parser.rb +74 -0
- data/lib/m/runner.rb +20 -0
- data/lib/m/runners/base.rb +17 -0
- data/lib/m/runners/minitest_4.rb +13 -0
- data/lib/m/runners/minitest_5.rb +17 -0
- data/lib/m/runners/test_unit.rb +13 -0
- data/lib/m/runners/unsupported_framework.rb +21 -0
- data/lib/m/testable.rb +15 -0
- data/lib/version.rb +1 -1
- data/m.gemspec +1 -1
- data/test/active_support_test.rb +17 -17
- data/test/bench.rb +25 -8
- data/test/empty_test.rb +1 -1
- data/test/everything_test.rb +11 -6
- data/test/examples/active_support_example_test.rb +0 -1
- data/test/examples/active_support_unescaped_example_test.rb +0 -1
- data/test/examples/empty_example_test.rb +2 -2
- data/test/examples/minitest_4_example_test.rb +4 -6
- data/test/examples/minitest_5_example_test.rb +4 -5
- data/test/examples/multiple_example_test.rb +0 -1
- data/test/examples/subdir/a_test.rb +2 -2
- data/test/examples/subdir/b_test.rb +2 -2
- data/test/examples/subdir/c_test.rb +2 -2
- data/test/examples/subdir_with_failures/a_test.rb +7 -0
- data/test/examples/test_unit_example_test.rb +12 -12
- data/test/minitest_4_test.rb +13 -13
- data/test/minitest_5_test.rb +6 -6
- data/test/multiple_test.rb +3 -3
- data/test/options_test.rb +6 -6
- data/test/test_helper.rb +13 -12
- data/test/test_unit_test.rb +29 -27
- metadata +13 -16
data/test/empty_test.rb
CHANGED
data/test/everything_test.rb
CHANGED
@@ -3,26 +3,31 @@ 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
|
6
|
+
assert_output(/12 tests/, output)
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_missing_file_gives_a_decent_error_message
|
10
10
|
output = m('examples/thisdoesnexist_test.rb')
|
11
11
|
assert !$?.success?
|
12
|
-
assert_match
|
13
|
-
assert_match
|
12
|
+
assert_match(/Failed loading test file/, output)
|
13
|
+
assert_match(/cannot load such file/, output)
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_running_tests_within_a_subdirectory
|
17
17
|
output = m('examples/subdir')
|
18
|
-
assert_output
|
18
|
+
assert_output(/3 tests/, output)
|
19
19
|
|
20
20
|
output = m('examples')
|
21
|
-
assert_output
|
21
|
+
assert_output(/12 tests/, output)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_running_tests_with_failures_within_a_subdirectory
|
25
|
+
output = m('examples/subdir_with_failures')
|
26
|
+
assert_output(/1 tests, 1 assertions, 1 failures/, output)
|
22
27
|
end
|
23
28
|
|
24
29
|
def test_blank_file_is_quieter
|
25
30
|
output = m('bananas')
|
26
|
-
|
31
|
+
assert(/Valid tests to run/ !~ output)
|
27
32
|
end
|
28
33
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'minitest/unit'
|
2
|
-
if M::Frameworks.minitest4?
|
3
2
|
|
3
|
+
if M::Frameworks.minitest4?
|
4
4
|
class Meme
|
5
5
|
def i_can_has_cheezburger?
|
6
6
|
"OHAI!"
|
@@ -11,7 +11,6 @@ if M::Frameworks.minitest4?
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
14
|
class TestMeme < MiniTest::Unit::TestCase
|
16
15
|
def setup
|
17
16
|
@meme = Meme.new
|
@@ -22,15 +21,14 @@ if M::Frameworks.minitest4?
|
|
22
21
|
end
|
23
22
|
|
24
23
|
def test_that_it_will_not_blend
|
25
|
-
refute_match
|
26
|
-
refute_match
|
27
|
-
refute_match
|
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?)
|
28
27
|
end
|
29
28
|
|
30
29
|
def test_that_kitty_can_eat_two_time
|
31
30
|
assert_equal "OHAI!", @meme.i_can_has_cheezburger?
|
32
31
|
assert_equal "OHAI!", @meme.i_can_has_cheezburger?
|
33
32
|
end
|
34
|
-
|
35
33
|
end
|
36
34
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'minitest/autorun'
|
2
|
+
|
2
3
|
if M::Frameworks.minitest5?
|
3
4
|
class Meme
|
4
5
|
def i_can_has_cheezburger?
|
@@ -10,7 +11,6 @@ if M::Frameworks.minitest5?
|
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
13
|
-
|
14
14
|
class TestMeme < Minitest::Test
|
15
15
|
def setup
|
16
16
|
@meme = Meme.new
|
@@ -21,15 +21,14 @@ if M::Frameworks.minitest5?
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_that_it_will_not_blend
|
24
|
-
refute_match
|
25
|
-
refute_match
|
26
|
-
refute_match
|
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
27
|
end
|
28
28
|
|
29
29
|
def test_that_kitty_can_eat_two_time
|
30
30
|
assert_equal "OHAI!", @meme.i_can_has_cheezburger?
|
31
31
|
assert_equal "OHAI!", @meme.i_can_has_cheezburger?
|
32
32
|
end
|
33
|
-
|
34
33
|
end
|
35
34
|
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
|
1
|
+
if M::Frameworks.test_unit?
|
2
|
+
class TestUnitExampleTest < Test::Unit::TestCase
|
3
|
+
def setup
|
4
|
+
end
|
2
5
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
def test_apple
|
8
|
-
assert_equal 1, 1
|
9
|
-
end
|
6
|
+
def test_apple
|
7
|
+
assert_equal 1, 1
|
8
|
+
end
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
def test_banana
|
11
|
+
assert_equal 1, 1
|
12
|
+
assert_equal 2, 2
|
13
|
+
assert_equal 3, 3
|
14
|
+
end
|
15
15
|
end
|
16
16
|
end
|
data/test/minitest_4_test.rb
CHANGED
@@ -1,39 +1,39 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
if M::Frameworks.minitest4?
|
3
2
|
|
3
|
+
if M::Frameworks.minitest4?
|
4
4
|
class Minitest4Test < MTest
|
5
5
|
def test_run_simple_test_by_line_number
|
6
|
-
output = m('examples/minitest_4_example_test.rb:
|
7
|
-
assert_output
|
6
|
+
output = m('examples/minitest_4_example_test.rb:19')
|
7
|
+
assert_output(/1 tests, 1 assertions/, output)
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_runs_entire_test_without_line_number
|
11
11
|
output = m('examples/minitest_4_example_test.rb')
|
12
|
-
assert_output
|
12
|
+
assert_output(/3 tests/, output)
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_run_inside_of_test
|
16
|
-
output = m('examples/minitest_4_example_test.rb:
|
17
|
-
assert_output
|
16
|
+
output = m('examples/minitest_4_example_test.rb:20')
|
17
|
+
assert_output(/1 tests, 1 assertions/, output)
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_run_on_end_of_test
|
21
|
-
output = m('examples/minitest_4_example_test.rb:
|
22
|
-
assert_output
|
21
|
+
output = m('examples/minitest_4_example_test.rb:21')
|
22
|
+
assert_output(/1 tests, 1 assertions/, output)
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_run_inside_big_test
|
26
26
|
output = m('examples/minitest_4_example_test.rb:26')
|
27
|
-
assert_output
|
27
|
+
assert_output(/1 tests, 6 assertions/, output)
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_run_on_blank_line
|
31
|
-
output = m('examples/minitest_4_example_test.rb:
|
31
|
+
output = m('examples/minitest_4_example_test.rb:2')
|
32
32
|
|
33
33
|
assert !$?.success?
|
34
|
-
assert_match
|
35
|
-
assert_match %r{ test_that_kitty_can_eat: m examples/minitest_4_example_test\.rb:
|
36
|
-
assert_match %r{test_that_it_will_not_blend: m examples/minitest_4_example_test\.rb:
|
34
|
+
assert_match(/No tests found on line 2. Valid tests to run:/, output)
|
35
|
+
assert_match %r{ test_that_kitty_can_eat: m examples/minitest_4_example_test\.rb:19}, output
|
36
|
+
assert_match %r{test_that_it_will_not_blend: m examples/minitest_4_example_test\.rb:23}, output
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
data/test/minitest_5_test.rb
CHANGED
@@ -3,34 +3,34 @@ if M::Frameworks.minitest5?
|
|
3
3
|
class Minitest5Test < MTest
|
4
4
|
def test_run_simple_test_by_line_number
|
5
5
|
output = m('examples/minitest_5_example_test.rb:19')
|
6
|
-
assert_output
|
6
|
+
assert_output(/1 runs, 1 assertions/, output)
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_runs_entire_test_without_line_number
|
10
10
|
output = m('examples/minitest_5_example_test.rb')
|
11
|
-
assert_output
|
11
|
+
assert_output(/3 runs/, output)
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_run_inside_of_test
|
15
15
|
output = m('examples/minitest_5_example_test.rb:20')
|
16
|
-
assert_output
|
16
|
+
assert_output(/1 runs, 1 assertions/, output)
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_run_on_end_of_test
|
20
20
|
output = m('examples/minitest_5_example_test.rb:21')
|
21
|
-
assert_output
|
21
|
+
assert_output(/1 runs, 1 assertions/, output)
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_run_inside_big_test
|
25
25
|
output = m('examples/minitest_5_example_test.rb:26')
|
26
|
-
assert_output
|
26
|
+
assert_output(/1 runs, 6 assertions/, output)
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_run_on_blank_line
|
30
30
|
output = m('examples/minitest_5_example_test.rb:3')
|
31
31
|
|
32
32
|
assert !$?.success?
|
33
|
-
assert_match
|
33
|
+
assert_match(/No tests found on line 3. Valid tests to run:/, output)
|
34
34
|
assert_match %r{ test_that_kitty_can_eat: m examples/minitest_5_example_test\.rb:19}, output
|
35
35
|
assert_match %r{test_that_it_will_not_blend: m examples/minitest_5_example_test\.rb:23}, output
|
36
36
|
end
|
data/test/multiple_test.rb
CHANGED
@@ -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
|
6
|
+
assert_output(/1 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
|
11
|
+
assert_output(/4 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
|
16
|
+
assert_output(/3 tests/, output)
|
17
17
|
end
|
18
18
|
end
|
data/test/options_test.rb
CHANGED
@@ -3,31 +3,31 @@ require 'test_helper'
|
|
3
3
|
class OptionsTest < MTest
|
4
4
|
def test_short_help_option
|
5
5
|
output = m('-h')
|
6
|
-
assert_output
|
6
|
+
assert_output(/^Usage: m \[OPTIONS\] \[FILES\]/, output)
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_long_help_option
|
10
10
|
output = m('--help')
|
11
|
-
assert_output
|
11
|
+
assert_output(/^Usage: m \[OPTIONS\] \[FILES\]/, output)
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_verbose_option
|
15
15
|
output = m('--version')
|
16
|
-
assert_output
|
16
|
+
assert_output(/^m #{M::VERSION}/, output)
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_short_line_option
|
20
20
|
output = m('-l20 examples/minitest_4_example_test.rb')
|
21
|
-
assert_output
|
21
|
+
assert_output(/1 tests, 1 assertions/, output)
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_long_line_option
|
25
25
|
output = m('--line 20 examples/minitest_4_example_test.rb')
|
26
|
-
assert_output
|
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
30
|
output = m('--line 20 examples/minitest_4_example_test.rb:2')
|
31
|
-
assert_output
|
31
|
+
assert_output(/1 tests, 1 assertions/, output)
|
32
32
|
end
|
33
33
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,13 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
Coveralls.wear!
|
5
|
-
end
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear_merged!
|
6
3
|
|
7
4
|
module Testable
|
8
5
|
def m(arguments)
|
9
6
|
Dir.chdir("test") do
|
10
|
-
`ruby -I../lib
|
7
|
+
`ruby -I../lib -I. ../bin/m #{arguments} 2>&1`.strip
|
11
8
|
end
|
12
9
|
end
|
13
10
|
|
@@ -17,17 +14,21 @@ module Testable
|
|
17
14
|
end
|
18
15
|
end
|
19
16
|
|
20
|
-
require '
|
17
|
+
require 'm'
|
21
18
|
require 'minitest/autorun'
|
22
|
-
if M::Frameworks.
|
23
|
-
class MTest < Minitest::Test
|
24
|
-
include ::Testable
|
25
|
-
end
|
26
|
-
else
|
19
|
+
if M::Frameworks.test_unit?
|
27
20
|
require 'test/unit'
|
28
21
|
require 'active_support/test_case'
|
29
22
|
|
30
23
|
class MTest < Test::Unit::TestCase
|
31
24
|
include ::Testable
|
32
25
|
end
|
26
|
+
elsif M::Frameworks.minitest5?
|
27
|
+
class MTest < Minitest::Test
|
28
|
+
include ::Testable
|
29
|
+
end
|
30
|
+
else
|
31
|
+
class MTest < MiniTest::Unit::TestCase
|
32
|
+
include ::Testable
|
33
|
+
end
|
33
34
|
end
|
data/test/test_unit_test.rb
CHANGED
@@ -1,37 +1,39 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
if M::Frameworks.test_unit?
|
4
|
+
class TestUnitTest < MTest
|
5
|
+
def test_run_simple_test_by_line_number
|
6
|
+
output = m('examples/test_unit_example_test.rb:7')
|
7
|
+
assert_output(/1 tests, 1 assertions/, output)
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
def test_runs_entire_test_without_line_number
|
11
|
+
output = m('examples/test_unit_example_test.rb')
|
12
|
+
assert_output(/2 tests/, output)
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
def test_run_inside_of_test
|
16
|
+
output = m('examples/test_unit_example_test.rb:8')
|
17
|
+
assert_output(/1 tests, 1 assertions/, output)
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
def test_run_on_end_of_test
|
21
|
+
output = m('examples/test_unit_example_test.rb:9')
|
22
|
+
assert_output(/1 tests, 1 assertions/, output)
|
23
|
+
end
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
def test_run_inside_big_test
|
26
|
+
output = m('examples/test_unit_example_test.rb:14')
|
27
|
+
assert_output(/1 tests, 3 assertions/, output)
|
28
|
+
end
|
28
29
|
|
29
|
-
|
30
|
-
|
30
|
+
def test_run_on_blank_line
|
31
|
+
output = m('examples/test_unit_example_test.rb:2')
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
assert !$?.success?
|
34
|
+
assert_match(/No tests found on line 2. Valid tests to run:/, output)
|
35
|
+
assert_match(%r{ test_apple: m examples/test_unit_example_test\.rb:7}, output)
|
36
|
+
assert_match(%r{test_banana: m examples/test_unit_example_test\.rb:11}, output)
|
37
|
+
end
|
36
38
|
end
|
37
39
|
end
|