From 5560d4b462e10c5430d7a74f445ffe0d1611d0cc Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 4 Oct 2015 23:11:57 +0000 Subject: player: cleanup command dispatch We can generate many command calls easily and dynamically, so avoid the code and cognitive overhead for the majority of commands. --- test/test_player_client_handler.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/test_player_client_handler.rb b/test/test_player_client_handler.rb index 1f349b9..a100ad1 100644 --- a/test/test_player_client_handler.rb +++ b/test/test_player_client_handler.rb @@ -19,23 +19,23 @@ class TestPlayerClientHandler < Testcase def test_delete @sinks["default"] = DTAS::Sink.new @targets = [] - sink_handler(@io, %w(rm default)) + dpc_sink(@io, %w(rm default)) assert @sinks.empty? assert_equal %w(OK), @io.to_a end def test_delete_noexist - sink_handler(@io, %w(rm default)) + dpc_sink(@io, %w(rm default)) assert @sinks.empty? assert_equal ["ERR default not found"], @io.to_a end def test_env - sink_handler(@io, %w(ed default env.FOO=bar)) + dpc_sink(@io, %w(ed default env.FOO=bar)) assert_equal "bar", @sinks["default"].env["FOO"] - sink_handler(@io, %w(ed default env.FOO=)) + dpc_sink(@io, %w(ed default env.FOO=)) assert_equal "", @sinks["default"].env["FOO"] - sink_handler(@io, %w(ed default env#FOO)) + dpc_sink(@io, %w(ed default env#FOO)) assert_nil @sinks["default"].env["FOO"] end @@ -47,12 +47,12 @@ class TestPlayerClientHandler < Testcase --disable-format --disable-resample --disable-channels \ -t raw -c $SINK_CHANNELS -f S${SINK_BITS}_3LE -r $SINK_RATE ' - sink_handler(@io, %W(ed foo command=#{command})) + dpc_sink(@io, %W(ed foo command=#{command})) assert_equal command, @sinks["foo"].command assert_empty @sinks["foo"].env - sink_handler(@io, %W(ed foo env.SINK_BITS=24)) - sink_handler(@io, %W(ed foo env.SINK_CHANNELS=2)) - sink_handler(@io, %W(ed foo env.SINK_RATE=48000)) + dpc_sink(@io, %W(ed foo env.SINK_BITS=24)) + dpc_sink(@io, %W(ed foo env.SINK_CHANNELS=2)) + dpc_sink(@io, %W(ed foo env.SINK_RATE=48000)) expect = { "SINK_BITS" => "24", "SINK_CHANNELS" => "2", @@ -68,7 +68,7 @@ class TestPlayerClientHandler < Testcase sink.name = "default" sink.command += "dither -s" @sinks["default"] = sink - sink_handler(@io, %W(cat default)) + dpc_sink(@io, %W(cat default)) assert_equal 1, @io.size hsh = YAML.load(@io[0]) assert_kind_of Hash, hsh @@ -79,12 +79,12 @@ class TestPlayerClientHandler < Testcase def test_ls expect = %w(a b c d) expect.each { |s| @sinks[s] = true } - sink_handler(@io, %W(ls)) + dpc_sink(@io, %W(ls)) assert_equal expect, Shellwords.split(@io[0]) end def test_env_dump - env_handler(@io, []) + dpc_env(@io, []) res = @io[0] result = {} Shellwords.split(res).each do |kv| -- cgit v1.2.3-24-ge0c7