Sha256: 02961b95d7292e3969de5a5c73c045dda2159b5f281b9921290a4cd84e4fcb83
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
#!/usr/bin/env ruby # encoding: UTF-8 require 'tins/xt' require 'tins/lines_file' include Tins::GO require 'utils' include Utils def usage puts <<-EOT Usage: #{File.basename($0)} [OPTS] FILENAME[:LINENO] Options are -n TESTNAME run the test TESTNAME in file FILENAME -h display this help Version is #{File.basename($0)} #{Utils::VERSION}. EOT exit 1 end def cmd(*args) puts args * ' ' exec *args end filename = ARGV.shift or fail "require filename or filename:line_number as first argument" $opt = go 'n:h' $opt['h'] and usage if testname = $opt['n'] cmd "testrb", '-I', 'lib:test:ext', '-n', testname , filename elsif filename =~ /^\s*([^:]+):(\d+)/ filename, line_number = $1, $2 lf = Tins::LinesFile.for_filename filename, line_number.to_i if testname = lf.match_backward(/def\s+(\S+?)(?:\(|\s*$)/).full?(:first) puts "Running test #{testname.inspect} at #{filename}:#{lf.line_number}" cmd "testrb", '-I', 'lib:test:ext', '-n', testname , filename else warn "no test found before line #{line_number}" exit 1 end else puts "Running ALL tests in #{filename}" cmd "testrb", '-Ilib:test:ext', filename end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
utils-0.0.22 | bin/probe |