Sha256: 572273e1020ea8099468d98910c864444c3cd876c10bae0fb125b429d3ebd441

Contents?: true

Size: 879 Bytes

Versions: 2

Compression:

Stored size: 879 Bytes

Contents

# vim:ft=ruby
require 'rubygems'
require 'watchr'

# helper methods
def run_all
  puts "\rrunning all tests. Hit CTRL-\\ to quit."
  sleep(1)
  system "ruby test/all.rb"
end
def single_or_all(fn)
  clear_screen
  if File.exist?(File.expand_path(fn))
    system "ruby -Ilib -Itest #{fn}"
  else
    run_all
  end
end
def clear_screen
  system "clear"
end

# test_runner-lambda
single_test = lambda { |m|
  single_or_all("test/test_#{m[1]}.rb")
}

# specific mappings
watch '^data/to_pass/(algorithms|converters)/*.rb' do |m|
  single_or_all("test/test_#{m[1]}.rb")
end
watch '^data/to_pass/config' do |m|
  single_or_all("test/test_configs.rb")
end
watch '^test/(helper|all).rb' do |m|
  run_all
end

# simple mappings
watch '^lib/to_pass/(.*).rb',  &single_test
watch '^test/test_(.*).rb', &single_test

Signal.trap 'QUIT' do
  abort("\n")
end
Signal.trap 'INT' do
  run_all
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
to_pass-1.0.1 test/tests.watchr
to_pass-1.0.0 test/tests.watchr