m 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby-ci.yml +3 -3
- data/.gitignore +1 -0
- data/.standard.yml +1 -0
- data/Gemfile +4 -6
- data/README.md +3 -25
- data/Rakefile +34 -82
- data/bin/m +2 -2
- data/gemfiles/minitest4.gemfile +2 -4
- data/gemfiles/minitest5.gemfile +2 -4
- data/gemfiles/test_unit_gem.gemfile +2 -4
- data/lib/error_tests/error_test.rb +1 -1
- data/lib/m/executor.rb +19 -23
- data/lib/m/frameworks.rb +20 -16
- data/lib/m/parser.rb +30 -31
- data/lib/m/runner.rb +3 -3
- data/lib/m/runners/base.rb +4 -4
- data/lib/m/runners/minitest_4.rb +1 -1
- data/lib/m/runners/minitest_5.rb +3 -5
- data/lib/m/runners/test_unit.rb +6 -6
- data/lib/m/runners/unsupported_framework.rb +2 -2
- data/lib/m/test_collection.rb +5 -5
- data/lib/m/test_method.rb +5 -5
- data/lib/m/testable.rb +2 -2
- data/lib/m/version.rb +1 -1
- data/lib/m.rb +4 -4
- data/m.gemspec +13 -14
- data/test/Rakefile +2 -2
- data/test/active_support_test.rb +17 -17
- data/test/allocations.rb +11 -13
- data/test/bench.rb +9 -9
- data/test/empty_test.rb +2 -2
- data/test/everything_test.rb +7 -7
- data/test/examples/active_support_example_test.rb +2 -5
- data/test/examples/active_support_unescaped_example_test.rb +2 -5
- data/test/examples/empty_example_test.rb +1 -1
- data/test/examples/minitest_4_example_test.rb +1 -1
- data/test/examples/minitest_5_example_test.rb +1 -1
- data/test/examples/minitest_example_test.rb +2 -2
- data/test/examples/multiple_example_test.rb +3 -3
- data/test/examples/subdir/a_test.rb +1 -1
- data/test/examples/subdir/another_subdir/d_test.rb +1 -1
- data/test/examples/subdir/another_subdir/yet_another_subdir/e_test.rb +1 -1
- data/test/examples/subdir/b_test.rb +1 -1
- data/test/examples/subdir/c_test.rb +1 -1
- data/test/examples/subdir_with_failures/a_test.rb +1 -1
- data/test/examples/test_unit_example_test.rb +2 -2
- data/test/exit_codes_test.rb +6 -6
- data/test/minitest_4_test.rb +7 -7
- data/test/minitest_5_test.rb +8 -8
- data/test/multiple_test.rb +4 -4
- data/test/options_test.rb +14 -14
- data/test/test_helper.rb +15 -17
- data/test/test_unit_test.rb +9 -9
- metadata +11 -69
- data/.travis.yml +0 -19
- data/Appraisals +0 -11
- data/Gemfile.lock +0 -74
- data/gemfiles/minitest4.gemfile.lock +0 -73
- data/gemfiles/minitest5.gemfile.lock +0 -73
- data/gemfiles/test_unit_gem.gemfile.lock +0 -76
@@ -6,14 +6,14 @@ module M
|
|
6
6
|
[]
|
7
7
|
end
|
8
8
|
|
9
|
-
def run
|
9
|
+
def run _test_arguments
|
10
10
|
not_supported
|
11
11
|
end
|
12
12
|
|
13
13
|
private
|
14
14
|
|
15
15
|
def not_supported
|
16
|
-
|
16
|
+
warn "This test framework is not supported! Please open up an issue at https://github.com/qrush/m !"
|
17
17
|
false
|
18
18
|
end
|
19
19
|
end
|
data/lib/m/test_collection.rb
CHANGED
@@ -11,18 +11,18 @@ module M
|
|
11
11
|
# internal collection
|
12
12
|
def_delegators :@collection, :size, :<<, :each
|
13
13
|
|
14
|
-
def initialize
|
14
|
+
def initialize collection = nil
|
15
15
|
@collection = collection || []
|
16
16
|
end
|
17
17
|
|
18
18
|
# Slice out tests that may be within the given line.
|
19
19
|
# Returns a new TestCollection with the results.
|
20
|
-
def within
|
20
|
+
def within lines
|
21
21
|
# Into a new collection, filter only the tests that...
|
22
22
|
collection = select do |test|
|
23
|
-
lines.none? || lines.any? { |line| (test.start_line..test.end_line).
|
23
|
+
lines.none? || lines.any? { |line| (test.start_line..test.end_line).cover?(line) }
|
24
24
|
end
|
25
|
-
self.class.new
|
25
|
+
self.class.new collection
|
26
26
|
end
|
27
27
|
|
28
28
|
# Used to line up method names in `#sprintf` when `m` aborts
|
@@ -33,7 +33,7 @@ module M
|
|
33
33
|
end
|
34
34
|
|
35
35
|
# Be considerate when printing out tests and pre-sort them by line number
|
36
|
-
def by_line_number
|
36
|
+
def by_line_number &block
|
37
37
|
# On each member of the collection, sort by line number and yield
|
38
38
|
# the block into the sorted collection
|
39
39
|
sort_by(&:start_line).each(&block)
|
data/lib/m/test_method.rb
CHANGED
@@ -8,12 +8,12 @@ module M
|
|
8
8
|
#
|
9
9
|
# Includes the name of this method, what line on the file it begins on,
|
10
10
|
# and where it ends.
|
11
|
-
|
11
|
+
TestMethod = Struct.new :name, :start_line, :end_line do
|
12
12
|
# Set up a new test method for this test suite class
|
13
|
-
def self.create
|
13
|
+
def self.create suite_class, test_method
|
14
14
|
# Hopefully it's been defined as an instance method, so we'll need to
|
15
15
|
# look up the ruby Method instance for it
|
16
|
-
method = suite_class.instance_method
|
16
|
+
method = suite_class.instance_method test_method
|
17
17
|
|
18
18
|
# Ruby can find the starting line for us, so pull that out of the array
|
19
19
|
start_line = method.source_location.last
|
@@ -24,11 +24,11 @@ module M
|
|
24
24
|
#
|
25
25
|
# The end line should be the number of line breaks in the method source,
|
26
26
|
# added to the starting line and subtracted by one.
|
27
|
-
|
27
|
+
|
28
28
|
end_line = method.source.split("\n").size + start_line - 1
|
29
29
|
|
30
30
|
# Shove the given attributes into a new databag
|
31
|
-
new
|
31
|
+
new test_method, start_line, end_line
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
data/lib/m/testable.rb
CHANGED
@@ -3,14 +3,14 @@ module M
|
|
3
3
|
attr_accessor :file, :recursive, :passthrough_options
|
4
4
|
attr_reader :lines
|
5
5
|
|
6
|
-
def initialize
|
6
|
+
def initialize file = "", lines = [], recursive = false
|
7
7
|
@file = file
|
8
8
|
@recursive = recursive
|
9
9
|
@passthrough_options = []
|
10
10
|
self.lines = lines
|
11
11
|
end
|
12
12
|
|
13
|
-
def lines=
|
13
|
+
def lines= lines
|
14
14
|
@lines = lines.map(&:to_i)
|
15
15
|
end
|
16
16
|
end
|
data/lib/m/version.rb
CHANGED
data/lib/m.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
### M, your metal test runner
|
2
2
|
# Maybe this gem should have a longer name? Metal?
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
3
|
+
require_relative "m/version"
|
4
|
+
require_relative "m/frameworks"
|
5
|
+
require_relative "m/runner"
|
6
6
|
|
7
7
|
module M
|
8
8
|
# Accept arguments coming from bin/m and run tests, then bail out immediately.
|
9
|
-
def self.run
|
9
|
+
def self.run argv
|
10
10
|
# sync output since we're going to exit hard and fast
|
11
11
|
$stdout.sync = true
|
12
12
|
$stderr.sync = true
|
data/m.gemspec
CHANGED
@@ -1,26 +1,25 @@
|
|
1
|
-
require
|
1
|
+
require "./lib/m"
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
|
-
gem.authors
|
5
|
-
gem.email
|
6
|
-
gem.homepage
|
4
|
+
gem.authors = ["Nick Quaranto"]
|
5
|
+
gem.email = ["nick@quaran.to"]
|
6
|
+
gem.homepage = "https://github.com/qrush/m"
|
7
|
+
gem.license = "MIT"
|
7
8
|
|
8
|
-
gem.executables
|
9
|
-
gem.files
|
10
|
-
gem.
|
11
|
-
gem.name = "m"
|
9
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
10
|
+
gem.files = `git ls-files`.split "\n"
|
11
|
+
gem.name = "m"
|
12
12
|
gem.require_paths = ["lib"]
|
13
|
-
gem.version
|
13
|
+
gem.version = M::VERSION
|
14
14
|
|
15
15
|
gem.add_runtime_dependency "method_source", ">= 0.6.7"
|
16
16
|
gem.add_runtime_dependency "rake", ">= 0.9.2.2"
|
17
17
|
|
18
18
|
gem.add_development_dependency "activesupport"
|
19
|
-
gem.add_development_dependency "
|
20
|
-
gem.add_development_dependency "rocco" unless defined? JRUBY_VERSION
|
21
|
-
gem.add_development_dependency "appraisal"
|
19
|
+
gem.add_development_dependency "standard"
|
22
20
|
|
23
|
-
gem.required_ruby_version = ">=
|
21
|
+
gem.required_ruby_version = ">= 2.7"
|
24
22
|
|
25
|
-
gem.summary = gem.description =
|
23
|
+
gem.summary = gem.description = "Run test/unit tests by line number. Metal!"
|
24
|
+
gem.metadata["rubygems_mfa_required"] = "true"
|
26
25
|
end
|
data/test/Rakefile
CHANGED
data/test/active_support_test.rb
CHANGED
@@ -1,53 +1,53 @@
|
|
1
|
-
require
|
1
|
+
require "test_helper"
|
2
2
|
|
3
3
|
class ActiveSupportTest < MTest
|
4
4
|
def test_run_simple_test_by_line_number
|
5
|
-
output = m
|
5
|
+
output = m "examples/active_support_example_test.rb:9"
|
6
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
|
-
output = m
|
10
|
+
output = m "examples/active_support_example_test.rb"
|
11
11
|
assert_output(/4 (runs|tests)/, output)
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_run_inside_of_test
|
15
|
-
output = m
|
15
|
+
output = m "examples/active_support_example_test.rb:10"
|
16
16
|
assert_output(/1 (runs|tests), 1 assertions/, output)
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_run_on_end_of_test
|
20
|
-
output = m
|
20
|
+
output = m "examples/active_support_example_test.rb:11"
|
21
21
|
assert_output(/1 (runs|tests), 1 assertions/, output)
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_run_inside_big_test
|
25
|
-
output = m
|
25
|
+
output = m "examples/active_support_example_test.rb:15"
|
26
26
|
assert_output(/1 (runs|tests), 3 assertions/, output)
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_run_on_blank_line_orders_tests_by_line_number
|
30
|
-
output = m
|
30
|
+
output = m "examples/active_support_example_test.rb:8"
|
31
31
|
|
32
32
|
assert !$?.success?
|
33
|
-
expected =
|
34
|
-
No tests found on line
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
test_eggplant_fig: m examples/active_support_example_test.rb:
|
40
|
-
|
33
|
+
expected = <<~OUTPUT
|
34
|
+
No tests found on line 8. Valid tests to run:
|
35
|
+
|
36
|
+
test_normal: m examples/active_support_example_test.rb:5
|
37
|
+
test_carrot: m examples/active_support_example_test.rb:9
|
38
|
+
test_daikon: m examples/active_support_example_test.rb:13
|
39
|
+
test_eggplant_fig: m examples/active_support_example_test.rb:19
|
40
|
+
OUTPUT
|
41
41
|
assert_equal expected.strip, output
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_run_on_test_with_spaces
|
45
|
-
output = m
|
45
|
+
output = m "examples/active_support_example_test.rb:19"
|
46
46
|
assert_output(/1 (runs|tests), 1 assertions/, output)
|
47
47
|
end
|
48
48
|
|
49
49
|
def test_run_on_test_with_unescaped_regular_express_characters
|
50
|
-
output = m
|
50
|
+
output = m "examples/active_support_unescaped_example_test.rb:5"
|
51
51
|
assert_output(/1 (runs|tests), 1 assertions/, output)
|
52
52
|
end
|
53
53
|
end
|
data/test/allocations.rb
CHANGED
@@ -1,23 +1,21 @@
|
|
1
|
-
$LOAD_PATH.unshift
|
2
|
-
require
|
3
|
-
require
|
1
|
+
$LOAD_PATH.unshift "lib"
|
2
|
+
require "m"
|
3
|
+
require "allocation_stats"
|
4
4
|
|
5
|
-
def benchmark_allocations
|
6
|
-
stats = AllocationStats.new(burn: burn).trace
|
7
|
-
yield
|
8
|
-
end
|
5
|
+
def benchmark_allocations burn: 1, &block
|
6
|
+
stats = AllocationStats.new(burn: burn).trace(&block)
|
9
7
|
|
10
|
-
columns = if ENV[
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
columns = if ENV["DETAIL"]
|
9
|
+
[:sourcefile, :sourceline, :class_plus]
|
10
|
+
else
|
11
|
+
[:class_plus]
|
12
|
+
end
|
15
13
|
|
16
14
|
puts stats.allocations(alias_paths: true).group_by(*columns).sort_by_size.to_text
|
17
15
|
end
|
18
16
|
|
19
17
|
benchmark_allocations do
|
20
18
|
10.times do
|
21
|
-
M::Runner.new([
|
19
|
+
M::Runner.new(["test/examples/minitest_5_example_test.rb:19"]).run
|
22
20
|
end
|
23
21
|
end
|
data/test/bench.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
|
-
require
|
1
|
+
require "benchmark/ips"
|
2
2
|
|
3
3
|
Benchmark.ips do |bench|
|
4
4
|
bench.report("running m on a file that doesn't exist") do
|
5
|
-
`ruby -Ilib ./bin/m failwhale 2>/dev/null`
|
5
|
+
`bundle exec ruby -Ilib ./bin/m failwhale 2>/dev/null`
|
6
6
|
end
|
7
7
|
|
8
8
|
bench.report("running m on an empty file") do
|
9
|
-
`ruby -Ilib ./bin/m test/examples/empty_example_test.rb 2>/dev/null`
|
9
|
+
`bundle exec ruby -Ilib ./bin/m test/examples/empty_example_test.rb 2>/dev/null`
|
10
10
|
end
|
11
11
|
|
12
12
|
bench.report("running m on an entire file with minitest4") do
|
13
|
-
`
|
13
|
+
`BUNDLE_GEMFILE=gemfiles/minitest4.gemfile bundle exec ruby -Ilib ./bin/m test/examples/minitest_4_example_test.rb 2>/dev/null`
|
14
14
|
end
|
15
15
|
|
16
16
|
bench.report("running m on an entire file with minitest5") do
|
17
|
-
`
|
17
|
+
`BUNDLE_GEMFILE=gemfiles/minitest5.gemfile bundle exec ruby -Ilib ./bin/m test/examples/minitest_5_example_test.rb 2>/dev/null`
|
18
18
|
end
|
19
19
|
|
20
20
|
bench.report("running m on an entire file with test-unit gem") do
|
21
|
-
`
|
21
|
+
`BUNDLE_GEMFILE=gemfiles/test_unit_gem.gemfile bundle exec ruby -Ilib ./bin/m test/examples/test_unit_example_test.rb 2>/dev/null`
|
22
22
|
end
|
23
23
|
|
24
24
|
bench.report("running m on a specific test with minitest4") do
|
25
|
-
`
|
25
|
+
`BUNDLE_GEMFILE=gemfiles/minitest4.gemfile bundle exec ruby -Ilib ./bin/m test/examples/minitest_4_example_test.rb:19 2>/dev/null`
|
26
26
|
end
|
27
27
|
|
28
28
|
bench.report("running m on a specific test with minitest5") do
|
29
|
-
`
|
29
|
+
`BUNDLE_GEMFILE=gemfiles/minitest5.gemfile bundle exec ruby -Ilib ./bin/m test/examples/minitest_5_example_test.rb:19 2>/dev/null`
|
30
30
|
end
|
31
31
|
|
32
32
|
bench.report("running m on a specific test with test-unit gem") do
|
33
|
-
`
|
33
|
+
`BUNDLE_GEMFILE=gemfiles/test_unit_gem.gemfile bundle exec ruby -Ilib ./bin/m test/examples/test_unit_example_test.rb:15 2>/dev/null`
|
34
34
|
end
|
35
35
|
end
|
data/test/empty_test.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
1
|
+
require "test_helper"
|
2
2
|
|
3
3
|
class EmptyTest < MTest
|
4
4
|
def test_run_simple_test_by_line_number
|
5
|
-
output = m
|
5
|
+
output = m "examples/empty_example_test.rb"
|
6
6
|
assert !$?.success?
|
7
7
|
assert_match(/There were no tests found./, output)
|
8
8
|
end
|
data/test/everything_test.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
require
|
1
|
+
require "test_helper"
|
2
2
|
|
3
3
|
class EverythingTest < MTest
|
4
4
|
def test_runs_entire_test_suite_with_no_arguments
|
5
|
-
output = m
|
5
|
+
output = m ""
|
6
6
|
assert_output(/12 (runs|tests)/, output)
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_missing_file_gives_a_decent_error_message
|
10
|
-
output = m
|
10
|
+
output = m "examples/thisdoesnexist_test.rb"
|
11
11
|
assert !$?.success?
|
12
12
|
assert_match(/Failed loading test file/, output)
|
13
13
|
if defined? JRUBY_VERSION
|
@@ -18,20 +18,20 @@ class EverythingTest < MTest
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_running_tests_within_a_subdirectory
|
21
|
-
output = m
|
21
|
+
output = m "examples/subdir"
|
22
22
|
assert_output(/3 (runs|tests)/, output)
|
23
23
|
|
24
|
-
output = m
|
24
|
+
output = m "examples"
|
25
25
|
assert_output(/12 (runs|tests)/, output)
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_running_tests_with_failures_within_a_subdirectory
|
29
|
-
output = m
|
29
|
+
output = m "examples/subdir_with_failures"
|
30
30
|
assert_output_for_failed_execution(/1 (runs|tests), 1 assertions, 1 failures/, output)
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_blank_file_is_quieter
|
34
|
-
output = m
|
34
|
+
output = m "bananas"
|
35
35
|
assert(/Valid tests to run/ !~ output)
|
36
36
|
end
|
37
37
|
end
|
@@ -1,10 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "active_support"
|
2
|
+
require "active_support/test_case"
|
3
3
|
|
4
4
|
class ActiveSupportExampleTest < ActiveSupport::TestCase
|
5
|
-
setup do
|
6
|
-
end
|
7
|
-
|
8
5
|
test "#assert_equal compares to objects (and ensures they are equal)" do
|
9
6
|
assert_equal 1, 1
|
10
7
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "minitest/unit"
|
2
2
|
|
3
3
|
class Meme
|
4
4
|
def i_can_has_cheezburger?
|
@@ -32,5 +32,5 @@ class TestMeme < Test
|
|
32
32
|
assert_equal "OHAI!", @meme.i_can_has_cheezburger?
|
33
33
|
end
|
34
34
|
|
35
|
-
Minitest.after_run { p "ran after run block" } if Minitest.respond_to?
|
35
|
+
Minitest.after_run { p "ran after run block" } if Minitest.respond_to? :after_run
|
36
36
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "active_support"
|
2
|
+
require "active_support/test_case"
|
3
3
|
|
4
4
|
class MultipleExampleTest < ActiveSupport::TestCase
|
5
|
-
|
5
|
+
["grape", "habanero", "iceplant"].each do |fruit|
|
6
6
|
test "#{fruit} is a fruit" do
|
7
7
|
assert_equal 1, 1
|
8
8
|
end
|
data/test/exit_codes_test.rb
CHANGED
@@ -2,32 +2,32 @@ require "test_helper"
|
|
2
2
|
|
3
3
|
class ExitCodesTest < MTest
|
4
4
|
def test_failing_test_returns_1
|
5
|
-
m
|
5
|
+
m "examples/subdir_with_failures/a_test"
|
6
6
|
refute $?.success?, "expected exit code to be 1 but it was #{$?.exitstatus}"
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_test_with_error_returns_1
|
10
|
-
m
|
10
|
+
m "../lib/error_tests/error_test"
|
11
11
|
refute $?.success?, "expected exit code to be 1 but it was #{$?.exitstatus}"
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_dir_with_failure_returns_1
|
15
|
-
m
|
15
|
+
m "examples/subdir_with_failures"
|
16
16
|
refute $?.success?, "expected exit code to be 1 but it was #{$?.exitstatus}"
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_dir_with_error_returns_1
|
20
|
-
m
|
20
|
+
m "../lib/error_tests"
|
21
21
|
refute $?.success?, "expected exit code to be 1 but it was #{$?.exitstatus}"
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_without_errors_or_failures_returns_0
|
25
|
-
m
|
25
|
+
m "examples/subdir/a_test"
|
26
26
|
assert $?.success?, "expected exit code to be 0 but it was #{$?.exitstatus}"
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_dir_without_errors_or_failures_returns_0
|
30
|
-
m
|
30
|
+
m "examples/subdir"
|
31
31
|
assert $?.success?, "expected exit code to be 0 but it was #{$?.exitstatus}"
|
32
32
|
end
|
33
33
|
end
|
data/test/minitest_4_test.rb
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
require
|
1
|
+
require "test_helper"
|
2
2
|
|
3
3
|
if M::Frameworks.minitest4?
|
4
4
|
class Minitest4Test < MTest
|
5
5
|
def test_run_simple_test_by_line_number
|
6
|
-
output = m
|
6
|
+
output = m "examples/minitest_4_example_test.rb:19"
|
7
7
|
assert_output(/1 tests, 1 assertions/, output)
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_runs_entire_test_without_line_number
|
11
|
-
output = m
|
11
|
+
output = m "examples/minitest_4_example_test.rb"
|
12
12
|
assert_output(/3 tests/, output)
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_run_inside_of_test
|
16
|
-
output = m
|
16
|
+
output = m "examples/minitest_4_example_test.rb:20"
|
17
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
|
21
|
+
output = m "examples/minitest_4_example_test.rb:21"
|
22
22
|
assert_output(/1 tests, 1 assertions/, output)
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_run_inside_big_test
|
26
|
-
output = m
|
26
|
+
output = m "examples/minitest_4_example_test.rb:26"
|
27
27
|
assert_output(/1 tests, 6 assertions/, output)
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_run_on_blank_line
|
31
|
-
output = m
|
31
|
+
output = m "examples/minitest_4_example_test.rb:2"
|
32
32
|
|
33
33
|
assert !$?.success?
|
34
34
|
assert_match(/No tests found on line 2. Valid tests to run:/, output)
|
data/test/minitest_5_test.rb
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
require
|
1
|
+
require "test_helper"
|
2
2
|
if M::Frameworks.minitest5?
|
3
3
|
class Minitest5Test < MTest
|
4
4
|
def test_run_simple_test_by_line_number
|
5
|
-
output = m
|
5
|
+
output = m "examples/minitest_5_example_test.rb:19"
|
6
6
|
assert_output(/1 runs, 1 assertions/, output)
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_runs_entire_test_without_line_number
|
10
|
-
output = m
|
10
|
+
output = m "examples/minitest_5_example_test.rb"
|
11
11
|
assert_output(/3 runs/, output)
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_run_inside_of_test
|
15
|
-
output = m
|
15
|
+
output = m "examples/minitest_5_example_test.rb:20"
|
16
16
|
assert_output(/1 runs, 1 assertions/, output)
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_run_on_end_of_test
|
20
|
-
output = m
|
20
|
+
output = m "examples/minitest_5_example_test.rb:21"
|
21
21
|
assert_output(/1 runs, 1 assertions/, output)
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_run_inside_big_test
|
25
|
-
output = m
|
25
|
+
output = m "examples/minitest_5_example_test.rb:26"
|
26
26
|
assert_output(/1 runs, 6 assertions/, output)
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_run_on_blank_line
|
30
|
-
output = m
|
30
|
+
output = m "examples/minitest_5_example_test.rb:3"
|
31
31
|
|
32
32
|
assert !$?.success?
|
33
33
|
assert_match(/No tests found on line 3. Valid tests to run:/, output)
|
@@ -36,7 +36,7 @@ if M::Frameworks.minitest5?
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_run_with_after_run_block
|
39
|
-
output = m
|
39
|
+
output = m "examples/minitest_5_example_test.rb"
|
40
40
|
|
41
41
|
assert_output(/ran after run block/, output)
|
42
42
|
end
|