Skip to content

Commit 2b1974c

Browse files
authored
Make it easier to run test files from the command line (#635)
Signed-off-by: James Couball <jcouball@yahoo.com>
1 parent 44acad4 commit 2b1974c

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ In order to ensure high quality, all pull requests must meet these requirements:
8484
While working on specific features you can run individual test files or
8585
a group of tests using `bin/test`:
8686

87-
# run a single file:
88-
$ bin/test tests/units/test_object.rb
87+
# run a single file (from tests/units):
88+
$ bin/test test_object
8989

9090
# run multiple files:
91-
$ bin/test tests/units/test_object.rb tests/units/test_archive.rb
91+
$ bin/test test_object test_archive
9292

9393
# run all unit tests:
9494
$ bin/test

bin/test

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ project_root = File.expand_path(File.join(__dir__, '..'))
1111

1212
$LOAD_PATH.unshift(File.join(project_root, 'tests'))
1313

14-
if ARGV.empty?
15-
paths = Dir.glob(File.join(project_root, 'tests/**/test_*.rb'))
16-
else
17-
paths = ARGV.map { |p| File.join(project_root, p) }
18-
end
14+
paths =
15+
if ARGV.empty?
16+
Dir.glob('tests/units/test_*.rb').map { |p| File.basename(p) }
17+
else
18+
ARGV
19+
end.map { |p| File.join(project_root, 'tests/units', p) }
1920

2021
paths.each { |p| require p }

0 commit comments

Comments
 (0)