diff options
author | Eric Wong <e@80x24.org> | 2014-07-06 22:45:23 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2014-07-06 22:45:23 +0000 |
commit | af4979ef2d4c7683a2b927686beaca74ce789f91 (patch) | |
tree | 5b05d0784872cdc17fedf3e1476b88734b599b13 /test | |
parent | 3471463325be6c990b3abd18b4d34f723440d19a (diff) | |
download | dtas-af4979ef2d4c7683a2b927686beaca74ce789f91.tar.gz |
This allows the same sound to be reused in tests.
Diffstat (limited to 'test')
-rw-r--r-- | test/helper.rb | 8 | ||||
-rw-r--r-- | test/test_splitfx.rb | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/test/helper.rb b/test/helper.rb index 1812e99..397d2c3 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -99,3 +99,11 @@ class Dir 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 diff --git a/test/test_splitfx.rb b/test/test_splitfx.rb index 12bb0d9..fd1873e 100644 --- a/test/test_splitfx.rb +++ b/test/test_splitfx.rb @@ -20,11 +20,7 @@ class TestSplitfx < Testcase sfx = DTAS::SplitFX.new Dir.mktmpdir do |dir| Dir.chdir(dir) do - # create a guitar pluck - 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 - foo.flac' - assert system(cmd), cmd.inspect + guitar_pluck("foo.flac") sfx.import(hash, {}) opts = { jobs: nil, silent: true } |