From 0f73acc225656517526b317a05ecab7e1311141b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 29 Aug 2013 09:29:40 +0000 Subject: remove "encoding: binary" header use We don't need it since IO#read(bytes, buf) will convert to ASCII-8BIT anyways. Everywhere else, we ensure path names are already binary. We do this mainly at the client layer before using Shellwords to escape the paths. We also must be careful about parsing output from soxi/avprobe which can show us metadata in whatever encoding is in the file. We must still handle data from parsing command output as binary, as the encoding of file metadata tends to vary. This also should buy us Syck compatibility for Ruby 1.9.3 users on Debian systems where Ruby 1.9.3 still uses Syck. --- test/covshow.rb | 1 - test/helper.rb | 1 - test/player_integration.rb | 1 - test/test_buffer.rb | 1 - test/test_format.rb | 1 - test/test_format_change.rb | 1 - test/test_player.rb | 1 - test/test_player_client_handler.rb | 1 - test/test_player_integration.rb | 1 - test/test_process.rb | 8 +++++++- test/test_rg_integration.rb | 1 - test/test_rg_state.rb | 1 - test/test_sink.rb | 1 - test/test_sink_pipe_size.rb | 1 - test/test_sink_tee_integration.rb | 1 - test/test_source_av.rb | 1 - test/test_source_sox.rb | 1 - test/test_unixserver.rb | 1 - test/test_util.rb | 1 - 19 files changed, 7 insertions(+), 19 deletions(-) (limited to 'test') diff --git a/test/covshow.rb b/test/covshow.rb index bc9a3e5..2fd48c6 100644 --- a/test/covshow.rb +++ b/test/covshow.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) # diff --git a/test/helper.rb b/test/helper.rb index f5cb68d..e993463 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong 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 diff --git a/test/player_integration.rb b/test/player_integration.rb index 79d4304..8ff1be2 100644 --- a/test/player_integration.rb +++ b/test/player_integration.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require './test/helper' diff --git a/test/test_buffer.rb b/test/test_buffer.rb index 249321f..259cd4f 100644 --- a/test/test_buffer.rb +++ b/test/test_buffer.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require './test/helper' diff --git a/test/test_format.rb b/test/test_format.rb index bbf64bf..0c0b292 100644 --- a/test/test_format.rb +++ b/test/test_format.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require './test/helper' diff --git a/test/test_format_change.rb b/test/test_format_change.rb index 0dcfb79..99c694a 100644 --- a/test/test_format_change.rb +++ b/test/test_format_change.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require './test/player_integration' diff --git a/test/test_player.rb b/test/test_player.rb index 5eff8ff..0fc776a 100644 --- a/test/test_player.rb +++ b/test/test_player.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require './test/helper' diff --git a/test/test_player_client_handler.rb b/test/test_player_client_handler.rb index 6f59d59..21d8489 100644 --- a/test/test_player_client_handler.rb +++ b/test/test_player_client_handler.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require './test/helper' diff --git a/test/test_player_integration.rb b/test/test_player_integration.rb index d1cbfb3..b60ed36 100644 --- a/test/test_player_integration.rb +++ b/test/test_player_integration.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require './test/player_integration' diff --git a/test/test_process.rb b/test/test_process.rb index ad2b641..7f7b014 100644 --- a/test/test_process.rb +++ b/test/test_process.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require './test/helper' @@ -6,6 +5,13 @@ require 'dtas/process' class TestProcess < Minitest::Unit::TestCase include DTAS::Process + def test_encoding + assert_equal Encoding::BINARY, qx('echo HIHIH').encoding + s = "" + a = qx('echo HIHIHI; echo >&2 BYEBYE', err_str: s) + assert_equal Encoding::BINARY, a.encoding + end + def test_qx_env assert_equal "WORLD\n", qx({"HELLO" => "WORLD"}, 'echo $HELLO') end diff --git a/test/test_rg_integration.rb b/test/test_rg_integration.rb index a3f15b7..23fd5d6 100644 --- a/test/test_rg_integration.rb +++ b/test/test_rg_integration.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require './test/player_integration' diff --git a/test/test_rg_state.rb b/test/test_rg_state.rb index 72ff45f..c79e716 100644 --- a/test/test_rg_state.rb +++ b/test/test_rg_state.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require './test/helper' diff --git a/test/test_sink.rb b/test/test_sink.rb index 4d9e159..2f39d1c 100644 --- a/test/test_sink.rb +++ b/test/test_sink.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require './test/helper' diff --git a/test/test_sink_pipe_size.rb b/test/test_sink_pipe_size.rb index 6b8eccd..18328df 100644 --- a/test/test_sink_pipe_size.rb +++ b/test/test_sink_pipe_size.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) begin diff --git a/test/test_sink_tee_integration.rb b/test/test_sink_tee_integration.rb index bd01529..1fd6b0f 100644 --- a/test/test_sink_tee_integration.rb +++ b/test/test_sink_tee_integration.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require './test/player_integration' diff --git a/test/test_source_av.rb b/test/test_source_av.rb index 072e2aa..c5344a5 100644 --- a/test/test_source_av.rb +++ b/test/test_source_av.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require './test/helper' diff --git a/test/test_source_sox.rb b/test/test_source_sox.rb index 4ba9ba3..ce7227b 100644 --- a/test/test_source_sox.rb +++ b/test/test_source_sox.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require './test/helper' diff --git a/test/test_unixserver.rb b/test/test_unixserver.rb index bc63305..68fd16b 100644 --- a/test/test_unixserver.rb +++ b/test/test_unixserver.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require './test/helper' diff --git a/test/test_util.rb b/test/test_util.rb index 19e47ab..e768050 100644 --- a/test/test_util.rb +++ b/test/test_util.rb @@ -1,4 +1,3 @@ -# -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) require './test/helper' -- cgit v1.2.3-24-ge0c7