m 1.5.0 → 1.5.1
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/README.md +5 -5
- data/lib/m.rb +1 -1
- data/lib/m/executor.rb +2 -2
- data/lib/m/parser.rb +6 -3
- data/lib/m/test_collection.rb +5 -6
- data/lib/m/testable.rb +5 -5
- data/lib/m/version.rb +3 -0
- metadata +4 -4
- data/lib/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: affae077a376d9f03c66b1fd655a5e9ddb27b617
|
4
|
+
data.tar.gz: 0e5dc79ab7498e49e94fcd76f84b4892da35f71b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba70266e07e1840bfe3ea5c383c7c0c389d2c9835e596f787c0d57e2a40a01e0b64a57f8a3d263faba6c7b5354402b4fb751cefae087380894f0f1aa3308fcff
|
7
|
+
data.tar.gz: 3516c16bc732573d7dbdb1c0a9df45d76ca59e57d06bf647ab571559fa07d636644494952321978832265010152d1157d982c4af5d1bebe07ddd6c303e6635cc
|
data/README.md
CHANGED
@@ -16,11 +16,11 @@ M.RB
|
|
16
16
|
________________________________________________________________________________
|
17
17
|
|
18
18
|
|
19
|
-
- [](https://rubygems.org/gems/m)
|
20
|
+
- [](https://codeclimate.com/github/qrush/m)
|
21
|
+
- [](https://travis-ci.org/qrush/m)
|
22
|
+
- [](https://gemnasium.com/qrush/m)
|
23
|
+
- [](https://coveralls.io/r/qrush/m)
|
24
24
|
|
25
25
|
|
26
26
|
INSTALL
|
data/lib/m.rb
CHANGED
data/lib/m/executor.rb
CHANGED
@@ -12,7 +12,7 @@ module M
|
|
12
12
|
|
13
13
|
def execute
|
14
14
|
# Locate tests to run that may be inside of this line. There could be more than one!
|
15
|
-
tests_to_run = tests.within(testable.
|
15
|
+
tests_to_run = tests.within(testable.lines)
|
16
16
|
|
17
17
|
# If we found any tests,
|
18
18
|
if tests_to_run.size > 0
|
@@ -26,7 +26,7 @@ module M
|
|
26
26
|
runner.run(test_arguments)
|
27
27
|
elsif tests.size > 0
|
28
28
|
# Otherwise we found no tests on this line, so you need to pick one.
|
29
|
-
message = "No tests found on line #{testable.
|
29
|
+
message = "No tests found on line #{testable.lines.join(', ')}. Valid tests to run:\n\n"
|
30
30
|
|
31
31
|
# For every test ordered by line number,
|
32
32
|
# spit out the test name and line number where it starts,
|
data/lib/m/parser.rb
CHANGED
@@ -15,8 +15,10 @@ module M
|
|
15
15
|
else
|
16
16
|
parse_options! argv
|
17
17
|
|
18
|
-
# Parse out ARGV, it should be coming in in a format like `test/test_file.rb:9`
|
19
|
-
|
18
|
+
# Parse out ARGV, it should be coming in in a format like `test/test_file.rb:9:19`
|
19
|
+
parsed = argv.first.split(':')
|
20
|
+
testable.file = parsed.shift
|
21
|
+
testable.lines = parsed if testable.lines.none?
|
20
22
|
|
21
23
|
# If this file is a directory, not a file, run the tests inside of this directory
|
22
24
|
if Dir.exist?(testable.file)
|
@@ -26,6 +28,7 @@ module M
|
|
26
28
|
t.libs << 'test'
|
27
29
|
t.libs << 'spec'
|
28
30
|
t.test_files = FileList[wildcard("test"), wildcard("spec")]
|
31
|
+
t.warning = false
|
29
32
|
end
|
30
33
|
# Invoke the rake task and exit, hopefully it'll work!
|
31
34
|
begin
|
@@ -64,7 +67,7 @@ module M
|
|
64
67
|
|
65
68
|
opts.on '-l', '--line LINE', Integer, 'Line number for file.' do |line|
|
66
69
|
p "parsing line #{line}"
|
67
|
-
testable.
|
70
|
+
testable.lines = [line]
|
68
71
|
end
|
69
72
|
|
70
73
|
opts.on '-r', '--recursive DIR', 'Search provided directory recursively.' do |directory|
|
data/lib/m/test_collection.rb
CHANGED
@@ -17,13 +17,12 @@ module M
|
|
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
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end)
|
22
|
+
collection = select do |test|
|
23
|
+
lines.none? || lines.any? { |line| (test.start_line..test.end_line).include?(line) }
|
24
|
+
end
|
25
|
+
self.class.new(collection)
|
27
26
|
end
|
28
27
|
|
29
28
|
# Used to line up method names in `#sprintf` when `m` aborts
|
data/lib/m/testable.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
module M
|
2
2
|
class Testable
|
3
3
|
attr_accessor :file, :recursive
|
4
|
-
attr_reader :
|
4
|
+
attr_reader :lines
|
5
5
|
|
6
|
-
def initialize(file = "",
|
6
|
+
def initialize(file = "", lines = [], recursive = false)
|
7
7
|
@file = file
|
8
|
-
@line = line
|
9
8
|
@recursive = recursive
|
9
|
+
self.lines = lines
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
13
|
-
@
|
12
|
+
def lines=(lines)
|
13
|
+
@lines = lines.map(&:to_i)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
data/lib/m/version.rb
ADDED
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.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Quaranto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: method_source
|
@@ -134,7 +134,7 @@ files:
|
|
134
134
|
- lib/m/test_collection.rb
|
135
135
|
- lib/m/test_method.rb
|
136
136
|
- lib/m/testable.rb
|
137
|
-
- lib/version.rb
|
137
|
+
- lib/m/version.rb
|
138
138
|
- m.gemspec
|
139
139
|
- rush.jpg
|
140
140
|
- test/Rakefile
|
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
version: '0'
|
183
183
|
requirements: []
|
184
184
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.
|
185
|
+
rubygems_version: 2.4.8
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: Run test/unit tests by line number. Metal!
|
data/lib/version.rb
DELETED