m 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 797baa07531404e7d5add0a5928b0a3997dae6c6
4
- data.tar.gz: b0210ac7b23dc08ce3666568c783cf44fcebffa1
3
+ metadata.gz: affae077a376d9f03c66b1fd655a5e9ddb27b617
4
+ data.tar.gz: 0e5dc79ab7498e49e94fcd76f84b4892da35f71b
5
5
  SHA512:
6
- metadata.gz: 47430e39fa825c9ce6f6c1ce0290a2bcde416edbaa5bf9113e7b5b0f53f532e563ece5ca322dd74bc686f82eabecf90dc5e513893b8845c57317cd3f3fd7d526
7
- data.tar.gz: 2a6b64f5c7eac7f794843e12699114c790ee2de5a7a92161fe71c9f237c82b8f67080a9b8608c0a00ebb553b99fb1f084024f3ef6900ac003ba6a949d839d75b
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
- - [![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)
19
+ - [![Gem Version](https://badge.fury.io/rb/m.svg)](https://rubygems.org/gems/m)
20
+ - [![Code Climate](https://codeclimate.com/github/qrush/m.svg)](https://codeclimate.com/github/qrush/m)
21
+ - [![Build Status](https://travis-ci.org/qrush/m.svg)](https://travis-ci.org/qrush/m)
22
+ - [![Dependency Status](https://gemnasium.com/qrush/m.svg)](https://gemnasium.com/qrush/m)
23
+ - [![Coverage Status](https://coveralls.io/repos/qrush/m/badge.svg?branch=master)](https://coveralls.io/r/qrush/m)
24
24
 
25
25
 
26
26
  INSTALL
data/lib/m.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  ### M, your metal test runner
2
2
  # Maybe this gem should have a longer name? Metal?
3
- require_relative 'version'
3
+ require_relative 'm/version'
4
4
  require_relative 'm/frameworks'
5
5
  require_relative 'm/runner'
6
6
 
@@ -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.line)
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.line}. Valid tests to run:\n\n"
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,
@@ -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
- testable.file, testable.line = argv.first.split(':')
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.line = line
70
+ testable.lines = [line]
68
71
  end
69
72
 
70
73
  opts.on '-r', '--recursive DIR', 'Search provided directory recursively.' do |directory|
@@ -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(line)
20
+ def within(lines)
21
21
  # Into a new collection, filter only the tests that...
22
- self.class.new(select do |test|
23
- # are within the given boundary for this method
24
- # or include everything if the line given is zero (no line)
25
- line.zero? || (test.start_line..test.end_line).include?(line)
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
@@ -1,16 +1,16 @@
1
1
  module M
2
2
  class Testable
3
3
  attr_accessor :file, :recursive
4
- attr_reader :line
4
+ attr_reader :lines
5
5
 
6
- def initialize(file = "", line = nil, recursive = false)
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 line=(line)
13
- @line ||= line.to_i
12
+ def lines=(lines)
13
+ @lines = lines.map(&:to_i)
14
14
  end
15
15
  end
16
16
  end
@@ -0,0 +1,3 @@
1
+ module M
2
+ VERSION = "1.5.1"
3
+ end
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.0
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: 2016-05-06 00:00:00.000000000 Z
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.5.1
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!
@@ -1,3 +0,0 @@
1
- module M
2
- VERSION = "1.5.0"
3
- end