test/helper.rb in dtas-0.7.0 vs test/helper.rb in dtas-0.8.0

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors +# Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) $stdout.sync = $stderr.sync = Thread.abort_on_exception = true require 'thread' WAIT_ALL_MTX = Mutex.new @@ -23,10 +23,16 @@ prev = prev.empty? ? {} : Marshal.load(prev) res.each do |filename, counts| # filter out stuff that's not in our project COVMATCH =~ filename or next + # For compatibility with https://bugs.ruby-lang.org/issues/9508 + # TODO: support those features if that gets merged into mainline + unless Array === counts + counts = counts[:lines] + end + merge = prev[filename] || [] merge = merge counts.each_with_index do |count, i| count or next merge[i] = (merge[i] || 0) + count @@ -42,18 +48,25 @@ Coverage.start at_exit { __covmerge } end -gem 'minitest' +begin + gem 'minitest' +rescue LoadError +end require 'minitest/autorun' require "tempfile" Testcase = begin Minitest::Test rescue NameError - Minitest::Unit::TestCase + begin + Minitest::Unit::TestCase # minitest 4 + rescue + MiniTest::Unit::TestCase # minitest 3 + end end FIFOS = [] def tmpfifo tmp = Tempfile.new(%w(dtas-test .fifo)) @@ -84,5 +97,13 @@ ensure FileUtils.remove_entry(d) end end end unless Dir.respond_to?(:mktmpdir) + +def guitar_pluck(outfile) + outfile =~ %r{\A[\w\./-]+\z} or raise ArgumentError, "bad chars" + cmd = '(for n in E2 A2 D3 G3 B3 E4; do '\ + 'sox -n -ts32 -c2 -r44100 - synth 4 pluck $n; done ) | ' \ + "sox -ts32 -c2 -r44100 - #{outfile}" + assert_equal(true, system(cmd), cmd) +end