diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-08-26 00:35:03 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-08-26 00:40:52 +0000 |
commit | 6d67d9c2af57233743187a92b7e651174d6eb42b (patch) | |
tree | 2c174e81b241de8d30786180e98e6d5f9979bd60 /test | |
parent | a1198562c51c5374a85d74e1cfe9e6a695384a3d (diff) | |
download | dtas-6d67d9c2af57233743187a92b7e651174d6eb42b.tar.gz |
I forgot :err is already handled by Process.spawn, so split out the functionality into err_str where we want to use it. Also, add a :no_raise flag which will allow us to better handle avprobe/soxi calls which can fail and avoid needless exceptions.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_process.rb | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/test/test_process.rb b/test/test_process.rb index a480312..012f18f 100644 --- a/test/test_process.rb +++ b/test/test_process.rb @@ -4,9 +4,30 @@ require './test/helper' require 'dtas/process' class TestProcess < Minitest::Unit::TestCase - include DTAS::Process + include DTAS::Process - def test_qx_env - assert_equal "WORLD\n", qx({"HELLO" => "WORLD"}, 'echo $HELLO') - end + def test_qx_env + assert_equal "WORLD\n", qx({"HELLO" => "WORLD"}, 'echo $HELLO') + end + + def test_qx_err + err = "/dev/null" + assert_equal "", qx('echo HELLO >&2', err: err) + assert_equal "/dev/null", err + end + + def test_qx_err_str + s = "" + assert_equal "", qx('echo HELLO >&2', err_str: s) + assert_equal "HELLO\n", s + end + + def test_qx_raise + assert_raises(RuntimeError) { qx('false') } + end + + def test_qx_no_raise + status = qx('false', no_raise: true) + refute status.success?, status.inspect + end end |