From 7b529511ddd1b463ce0eea10a82ddeaea2e207ff Mon Sep 17 00:00:00 2001 From: Magnar Sveen Date: Mon, 24 Sep 2012 23:55:58 +0200 Subject: [PATCH] Add watchr script to get autotest --- watch-tests.watchr | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 watch-tests.watchr diff --git a/watch-tests.watchr b/watch-tests.watchr new file mode 100644 index 0000000..8146789 --- /dev/null +++ b/watch-tests.watchr @@ -0,0 +1,38 @@ +ENV["WATCHR"] = "1" +system 'clear' + +def run(cmd) + `#{cmd}` +end + +def run_all_tests + system('clear') + result = run "./run-tests.sh" + puts result +end + +run_all_tests +watch('.*.el') { run_all_tests } + +# Ctrl-\ +Signal.trap 'QUIT' do + puts " --- Running all tests ---\n\n" + run_all_tests +end + +@interrupted = false + +# Ctrl-C +Signal.trap 'INT' do + if @interrupted then + @wants_to_quit = true + abort("\n") + else + puts "Interrupt a second time to quit" + @interrupted = true + Kernel.sleep 1.5 + # raise Interrupt, nil # let the run loop catch it + run_all_tests + @interrupted = false + end +end