From 02a733d52403b95a72cd402e09554dd2c8ec6ae8 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Mon, 18 Nov 2024 04:30:47 -0600 Subject: [PATCH 01/27] Console application for filtering CSV --- bin/csv-filter | 36 +++++ test/csv/csv-filter/test_csv_filter.rb | 179 +++++++++++++++++++++++++ 2 files changed, 215 insertions(+) create mode 100644 bin/csv-filter create mode 100644 test/csv/csv-filter/test_csv_filter.rb diff --git a/bin/csv-filter b/bin/csv-filter new file mode 100644 index 00000000..ffe2f0ef --- /dev/null +++ b/bin/csv-filter @@ -0,0 +1,36 @@ +#!/usr/bin/env ruby + +require 'optparse' +require 'csv' + +options = {} + +parser = OptionParser.new + +parser.version = CSV::VERSION +parser.banner = <<-BANNER +Usage: #{parser.program_name} [options] + + Reads and parses the CSV text content of the standard input per the given input options. + From that content, generates CSV text per the given output options + and writes that text to the standard output. + +BANNER + +parser.separator('Generic Options') +parser.separator(nil) + +parser.on('-h', '--help', 'Prints this help.') do + puts parser + exit +end + +parser.on('-v', '--version', 'Prints version.') do + puts CSV::VERSION + exit +end + +parser.parse! + +CSV.filter(**options) do |row| +end diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb new file mode 100644 index 00000000..518e6b36 --- /dev/null +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -0,0 +1,179 @@ +# -*- coding: utf-8 -*- +# frozen_string_literal: false + +require_relative '../helper' + +require 'csv' + +class TestFilter < Test::Unit::TestCase + + # Some rows data (useful as default). + Rows = [ + %w[aaa bbb ccc], + %w[ddd eee fff], + ] + + def setup + # In case the previous test left this as true. + $TEST_DEBUG = false + end + + # Print debugging information if indicated. + def debug(label, value, newline: false) + return unless $TEST_DEBUG + print("\n") if newline + printf("%15s: %s\n", label, value.inspect) + end + + # Return the test name (retrieved from the call stack). + def get_test_name + caller.each do |x| + method_name = x.split(' ').last.gsub(/\W/, '') + return method_name if method_name.start_with?('test') + end + raise RuntimeError.new('No test method name found.') + end + + # Perform the testing defined in the caller's block. + def do_test(debugging: false) + # Just the caller's block, unless debugging. + unless debugging + yield + return + end + # Wrap the caller's block with debugging information. + $TEST_DEBUG = true + test_name = get_test_name + debug('BEGIN', test_name, newline: true) + yield + debug('END', test_name) + $TEST_DEBUG = false + end + + # Return CSV string generated from rows array and options. + def make_csv_s(rows: Rows, **options) + csv_s = CSV.generate(**options) do|csv| + rows.each do |row| + csv << row + end + end + csv_s + end + + # Return filepath of file containing CSV data. + def csv_filepath(csv_in_s, dirpath, option_sym) + filename = "#{option_sym}.csv" + filepath = File.join(dirpath, filename) + File.write(filepath, csv_in_s) + filepath + end + + # Return stdout and stderr from CLI execution. + def execute_in_cli(filepath, cli_options_s = '') + debug('cli_options_s', cli_options_s) + command = "cat #{filepath} | ruby bin/csv-filter #{cli_options_s}" + capture_subprocess_io do + system(command) + end + end + + # Return results for CLI-only option (or invalid option). + def results_for_cli_option(option_name) + cli_out_s = '' + cli_err_s = '' + Dir.mktmpdir do |dirpath| + sym = option_name.to_sym + filepath = csv_filepath('', dirpath, sym) + cli_out_s, cli_err_s = execute_in_cli(filepath, option_name) + end + [cli_out_s, cli_err_s] + end + + # Get and return the actual output from the API. + def get_via_api(csv_in_s, **api_options) + cli_out_s = '' + CSV.filter(csv_in_s, cli_out_s, **api_options) {|row| } + cli_out_s + end + + # Test for invalid option. + + def test_invalid_option + do_test(debugging: false) do + %w[-Z --ZZZ].each do |option_name| + cli_out_s, cli_err_s = results_for_cli_option(option_name) + assert_empty(cli_out_s) + assert_match(/OptionParser::InvalidOption/, cli_err_s) + end + end + end + + # Test for no options. + + def test_no_options + do_test(debugging: false) do + csv_in_s = make_csv_s + cli_out_s = get_via_api(csv_in_s) + assert_equal(csv_in_s, cli_out_s) + end + end + + # Tests for general options. + + def test_option_h + do_test(debugging: false) do + %w[-h --help].each do |option_name| + cli_out_s, cli_err_s = results_for_cli_option(option_name) + assert_match(/Usage/, cli_out_s) + assert_empty(cli_err_s) + end + end + end + + def test_option_v + do_test(debugging: false) do + %w[-v --version].each do |option_name| + cli_out_s, cli_err_s = results_for_cli_option(option_name) + assert_match(/\d+\.\d+\.\d+/, cli_out_s) + assert_empty(cli_err_s) + end + end + end + + # Two methods copied from module Minitest::Assertions. + # because we need access to the subprocess io. + + def _synchronize # :nodoc: + yield + end + + def capture_subprocess_io + _synchronize do + begin + require "tempfile" + + captured_stdout, captured_stderr = Tempfile.new("out"), Tempfile.new("err") + + orig_stdout, orig_stderr = $stdout.dup, $stderr.dup + $stdout.reopen captured_stdout + $stderr.reopen captured_stderr + + yield + + $stdout.rewind + $stderr.rewind + + return captured_stdout.read, captured_stderr.read + ensure + $stdout.reopen orig_stdout + $stderr.reopen orig_stderr + + orig_stdout.close + orig_stderr.close + captured_stdout.close! + captured_stderr.close! + end + end + end + +end From c23e371bfcec5affdf0f3d986bde279fce34d2fe Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Mon, 16 Dec 2024 15:15:37 -0600 Subject: [PATCH 02/27] Update test/csv/csv-filter/test_csv_filter.rb Co-authored-by: Sutou Kouhei --- test/csv/csv-filter/test_csv_filter.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index 518e6b36..9dac9631 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -52,12 +52,11 @@ def do_test(debugging: false) # Return CSV string generated from rows array and options. def make_csv_s(rows: Rows, **options) - csv_s = CSV.generate(**options) do|csv| + CSV.generate(**options) do|csv| rows.each do |row| csv << row end end - csv_s end # Return filepath of file containing CSV data. From f6a7b29cb30ac2386c810b07bc5779df9f64e682 Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Mon, 16 Dec 2024 15:15:53 -0600 Subject: [PATCH 03/27] Update test/csv/csv-filter/test_csv_filter.rb Co-authored-by: Sutou Kouhei --- test/csv/csv-filter/test_csv_filter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index 9dac9631..c74d0ebc 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -101,7 +101,7 @@ def test_invalid_option do_test(debugging: false) do %w[-Z --ZZZ].each do |option_name| cli_out_s, cli_err_s = results_for_cli_option(option_name) - assert_empty(cli_out_s) + assert_equal("", cli_out_s) assert_match(/OptionParser::InvalidOption/, cli_err_s) end end From e929d19323deb227656b78d0f23e099268135424 Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Mon, 16 Dec 2024 15:16:59 -0600 Subject: [PATCH 04/27] Update test/csv/csv-filter/test_csv_filter.rb Co-authored-by: Sutou Kouhei --- test/csv/csv-filter/test_csv_filter.rb | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index c74d0ebc..dff28b4e 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -70,9 +70,22 @@ def csv_filepath(csv_in_s, dirpath, option_sym) # Return stdout and stderr from CLI execution. def execute_in_cli(filepath, cli_options_s = '') debug('cli_options_s', cli_options_s) - command = "cat #{filepath} | ruby bin/csv-filter #{cli_options_s}" - capture_subprocess_io do - system(command) + top_dir = File.join(__dir__, "..", "..", "..") + command_line = [ + Gem.ruby, + "-I", + File.join(top_dir, "lib"), + File.join(top_dir, "bin", "csv-filter"), + *options, + filepath, + ] + Tempfile.create("stdout", mode: "rw") do |stdout| + Tempfile.create("stderr", mode: "rw") do |stderr| + status = system(*command_line, {1 => stdout, 2 => stderr}) + stdout.rewind + stderr.rewind + [status, stdout.read, stderr.read] + end end end From c6f9dd65186f8aeae64f7fe6d601cf11a96ada66 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Mon, 16 Dec 2024 16:03:22 -0600 Subject: [PATCH 05/27] Respond to review --- bin/csv-filter | 10 -- test/csv/csv-filter/test_csv_filter.rb | 131 ++++--------------------- 2 files changed, 21 insertions(+), 120 deletions(-) diff --git a/bin/csv-filter b/bin/csv-filter index ffe2f0ef..1a9326d7 100644 --- a/bin/csv-filter +++ b/bin/csv-filter @@ -20,16 +20,6 @@ BANNER parser.separator('Generic Options') parser.separator(nil) -parser.on('-h', '--help', 'Prints this help.') do - puts parser - exit -end - -parser.on('-v', '--version', 'Prints version.') do - puts CSV::VERSION - exit -end - parser.parse! CSV.filter(**options) do |row| diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index dff28b4e..c667f8af 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # frozen_string_literal: false require_relative '../helper' @@ -13,43 +12,6 @@ class TestFilter < Test::Unit::TestCase %w[ddd eee fff], ] - def setup - # In case the previous test left this as true. - $TEST_DEBUG = false - end - - # Print debugging information if indicated. - def debug(label, value, newline: false) - return unless $TEST_DEBUG - print("\n") if newline - printf("%15s: %s\n", label, value.inspect) - end - - # Return the test name (retrieved from the call stack). - def get_test_name - caller.each do |x| - method_name = x.split(' ').last.gsub(/\W/, '') - return method_name if method_name.start_with?('test') - end - raise RuntimeError.new('No test method name found.') - end - - # Perform the testing defined in the caller's block. - def do_test(debugging: false) - # Just the caller's block, unless debugging. - unless debugging - yield - return - end - # Wrap the caller's block with debugging information. - $TEST_DEBUG = true - test_name = get_test_name - debug('BEGIN', test_name, newline: true) - yield - debug('END', test_name) - $TEST_DEBUG = false - end - # Return CSV string generated from rows array and options. def make_csv_s(rows: Rows, **options) CSV.generate(**options) do|csv| @@ -68,23 +30,22 @@ def csv_filepath(csv_in_s, dirpath, option_sym) end # Return stdout and stderr from CLI execution. - def execute_in_cli(filepath, cli_options_s = '') - debug('cli_options_s', cli_options_s) + def run_csv_filter(filepath, cli_options_s = '') top_dir = File.join(__dir__, "..", "..", "..") - command_line = [ + command_line_s = [ Gem.ruby, "-I", File.join(top_dir, "lib"), File.join(top_dir, "bin", "csv-filter"), - *options, + cli_options_s, filepath, - ] - Tempfile.create("stdout", mode: "rw") do |stdout| - Tempfile.create("stderr", mode: "rw") do |stderr| - status = system(*command_line, {1 => stdout, 2 => stderr}) + ].join(' ') + Tempfile.create("stdout", mode: File::RDWR) do |stdout| + Tempfile.create("stderr", mode: File::RDWR) do |stderr| + status = system(command_line_s, {1 => stdout, 2 => stderr}) stdout.rewind stderr.rewind - [status, stdout.read, stderr.read] + [stdout.read, stderr.read] end end end @@ -96,7 +57,7 @@ def results_for_cli_option(option_name) Dir.mktmpdir do |dirpath| sym = option_name.to_sym filepath = csv_filepath('', dirpath, sym) - cli_out_s, cli_err_s = execute_in_cli(filepath, option_name) + cli_out_s, cli_err_s = run_csv_filter(filepath, option_name) end [cli_out_s, cli_err_s] end @@ -111,81 +72,31 @@ def get_via_api(csv_in_s, **api_options) # Test for invalid option. def test_invalid_option - do_test(debugging: false) do - %w[-Z --ZZZ].each do |option_name| - cli_out_s, cli_err_s = results_for_cli_option(option_name) - assert_equal("", cli_out_s) - assert_match(/OptionParser::InvalidOption/, cli_err_s) - end - end + cli_out_s, cli_err_s = results_for_cli_option('-Z') + assert_equal("", cli_out_s) + assert_match(/OptionParser::InvalidOption/, cli_err_s) end # Test for no options. def test_no_options - do_test(debugging: false) do - csv_in_s = make_csv_s - cli_out_s = get_via_api(csv_in_s) - assert_equal(csv_in_s, cli_out_s) - end + csv_in_s = make_csv_s + cli_out_s = get_via_api(csv_in_s) + assert_equal(csv_in_s, cli_out_s) end # Tests for general options. def test_option_h - do_test(debugging: false) do - %w[-h --help].each do |option_name| - cli_out_s, cli_err_s = results_for_cli_option(option_name) - assert_match(/Usage/, cli_out_s) - assert_empty(cli_err_s) - end - end + cli_out_s, cli_err_s = results_for_cli_option('-h') + assert_equal("Usage: csv-filter [options]\n", cli_out_s.lines.first) + assert_equal('', cli_err_s) end def test_option_v - do_test(debugging: false) do - %w[-v --version].each do |option_name| - cli_out_s, cli_err_s = results_for_cli_option(option_name) - assert_match(/\d+\.\d+\.\d+/, cli_out_s) - assert_empty(cli_err_s) - end - end - end - - # Two methods copied from module Minitest::Assertions. - # because we need access to the subprocess io. - - def _synchronize # :nodoc: - yield - end - - def capture_subprocess_io - _synchronize do - begin - require "tempfile" - - captured_stdout, captured_stderr = Tempfile.new("out"), Tempfile.new("err") - - orig_stdout, orig_stderr = $stdout.dup, $stderr.dup - $stdout.reopen captured_stdout - $stderr.reopen captured_stderr - - yield - - $stdout.rewind - $stderr.rewind - - return captured_stdout.read, captured_stderr.read - ensure - $stdout.reopen orig_stdout - $stderr.reopen orig_stderr - - orig_stdout.close - orig_stderr.close - captured_stdout.close! - captured_stderr.close! - end - end + cli_out_s, cli_err_s = results_for_cli_option('-v') + assert_match(/\d+\.\d+\.\d+/, cli_out_s) + assert_equal('', cli_err_s) end end From 6a01bbfcac7116d143b90bc38e7affc15fe12de7 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Mon, 16 Dec 2024 16:08:27 -0600 Subject: [PATCH 06/27] Respond to review --- test/csv/csv-filter/test_csv_filter.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index c667f8af..c98efa49 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -30,14 +30,14 @@ def csv_filepath(csv_in_s, dirpath, option_sym) end # Return stdout and stderr from CLI execution. - def run_csv_filter(filepath, cli_options_s = '') + def run_csv_filter(filepath, cli_option_names = []) top_dir = File.join(__dir__, "..", "..", "..") command_line_s = [ Gem.ruby, "-I", File.join(top_dir, "lib"), File.join(top_dir, "bin", "csv-filter"), - cli_options_s, + * cli_option_names, filepath, ].join(' ') Tempfile.create("stdout", mode: File::RDWR) do |stdout| @@ -57,7 +57,7 @@ def results_for_cli_option(option_name) Dir.mktmpdir do |dirpath| sym = option_name.to_sym filepath = csv_filepath('', dirpath, sym) - cli_out_s, cli_err_s = run_csv_filter(filepath, option_name) + cli_out_s, cli_err_s = run_csv_filter(filepath, [option_name]) end [cli_out_s, cli_err_s] end From 8fee5050bf9162206103e3ec3cf1f6ba76728e5e Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Tue, 17 Dec 2024 17:14:57 -0600 Subject: [PATCH 07/27] Update test/csv/csv-filter/test_csv_filter.rb Co-authored-by: Sutou Kouhei --- test/csv/csv-filter/test_csv_filter.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index c98efa49..0c863da6 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -6,11 +6,12 @@ class TestFilter < Test::Unit::TestCase - # Some rows data (useful as default). - Rows = [ - %w[aaa bbb ccc], - %w[ddd eee fff], - ] + def setup + @rows = [ + %w[aaa bbb ccc], + %w[ddd eee fff], + ] + end # Return CSV string generated from rows array and options. def make_csv_s(rows: Rows, **options) From c35417685d20d7ac3480a7b44332e4b7ecfab900 Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Tue, 17 Dec 2024 17:15:45 -0600 Subject: [PATCH 08/27] Update test/csv/csv-filter/test_csv_filter.rb Co-authored-by: Sutou Kouhei --- test/csv/csv-filter/test_csv_filter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index 0c863da6..964b9e16 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -31,7 +31,7 @@ def csv_filepath(csv_in_s, dirpath, option_sym) end # Return stdout and stderr from CLI execution. - def run_csv_filter(filepath, cli_option_names = []) + def run_csv_filter(filepath, *cli_option_names) top_dir = File.join(__dir__, "..", "..", "..") command_line_s = [ Gem.ruby, From 97444e76b376cfe3ae88f5fba9d36411b6ffcac7 Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Tue, 17 Dec 2024 17:16:39 -0600 Subject: [PATCH 09/27] Update test/csv/csv-filter/test_csv_filter.rb Co-authored-by: Sutou Kouhei --- test/csv/csv-filter/test_csv_filter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index 964b9e16..7d8686bb 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -38,7 +38,7 @@ def run_csv_filter(filepath, *cli_option_names) "-I", File.join(top_dir, "lib"), File.join(top_dir, "bin", "csv-filter"), - * cli_option_names, + *cli_option_names, filepath, ].join(' ') Tempfile.create("stdout", mode: File::RDWR) do |stdout| From 7102e61ee40649d15455b6e7f790d52bee26c1a9 Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Tue, 17 Dec 2024 17:17:42 -0600 Subject: [PATCH 10/27] Update test/csv/csv-filter/test_csv_filter.rb Co-authored-by: Sutou Kouhei --- test/csv/csv-filter/test_csv_filter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index 7d8686bb..df2c9f01 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -89,7 +89,7 @@ def test_no_options # Tests for general options. def test_option_h - cli_out_s, cli_err_s = results_for_cli_option('-h') + output, error = results_for_cli_option('-h') assert_equal("Usage: csv-filter [options]\n", cli_out_s.lines.first) assert_equal('', cli_err_s) end From cdc2b4772bdb50e491ae363ccd02c9a155c55e41 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Tue, 17 Dec 2024 17:52:46 -0600 Subject: [PATCH 11/27] Respond to review --- test/csv/csv-filter/test_csv_filter.rb | 67 +++++++++++--------------- 1 file changed, 28 insertions(+), 39 deletions(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index df2c9f01..0f5b46de 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -2,38 +2,28 @@ require_relative '../helper' -require 'csv' - class TestFilter < Test::Unit::TestCase def setup - @rows = [ - %w[aaa bbb ccc], - %w[ddd eee fff], - ] - end - - # Return CSV string generated from rows array and options. - def make_csv_s(rows: Rows, **options) - CSV.generate(**options) do|csv| - rows.each do |row| - csv << row - end - end + @input = [ + %w[aaa bbb ccc].join(','), + %w[ddd eee fff].join(','), + '' # Force trailing newline. + ].join("\n") end # Return filepath of file containing CSV data. - def csv_filepath(csv_in_s, dirpath, option_sym) - filename = "#{option_sym}.csv" + def csv_filepath(input, dirpath, option) + filename = "#{option}.csv" filepath = File.join(dirpath, filename) - File.write(filepath, csv_in_s) + File.write(filepath, input) filepath end # Return stdout and stderr from CLI execution. def run_csv_filter(filepath, *cli_option_names) top_dir = File.join(__dir__, "..", "..", "..") - command_line_s = [ + command_line = [ Gem.ruby, "-I", File.join(top_dir, "lib"), @@ -43,7 +33,7 @@ def run_csv_filter(filepath, *cli_option_names) ].join(' ') Tempfile.create("stdout", mode: File::RDWR) do |stdout| Tempfile.create("stderr", mode: File::RDWR) do |stderr| - status = system(command_line_s, {1 => stdout, 2 => stderr}) + status = system(command_line, {1 => stdout, 2 => stderr}) stdout.rewind stderr.rewind [stdout.read, stderr.read] @@ -53,51 +43,50 @@ def run_csv_filter(filepath, *cli_option_names) # Return results for CLI-only option (or invalid option). def results_for_cli_option(option_name) - cli_out_s = '' - cli_err_s = '' + output = '' + error = '' Dir.mktmpdir do |dirpath| sym = option_name.to_sym filepath = csv_filepath('', dirpath, sym) - cli_out_s, cli_err_s = run_csv_filter(filepath, [option_name]) + output, error = run_csv_filter(filepath, [option_name]) end - [cli_out_s, cli_err_s] + [output, error] end # Get and return the actual output from the API. - def get_via_api(csv_in_s, **api_options) - cli_out_s = '' - CSV.filter(csv_in_s, cli_out_s, **api_options) {|row| } - cli_out_s + def api_output(input, **api_options) + output = '' + CSV.filter(input, output, **api_options) {|row| } + output end # Test for invalid option. def test_invalid_option - cli_out_s, cli_err_s = results_for_cli_option('-Z') - assert_equal("", cli_out_s) - assert_match(/OptionParser::InvalidOption/, cli_err_s) + output, error = results_for_cli_option('-Z') + assert_equal("", output) + assert_match(/OptionParser::InvalidOption/, error) end # Test for no options. def test_no_options - csv_in_s = make_csv_s - cli_out_s = get_via_api(csv_in_s) - assert_equal(csv_in_s, cli_out_s) + output = api_output(@input) + assert_equal(@input, output) end # Tests for general options. def test_option_h output, error = results_for_cli_option('-h') - assert_equal("Usage: csv-filter [options]\n", cli_out_s.lines.first) - assert_equal('', cli_err_s) + assert_equal("Usage: csv-filter [options]\n", output.lines.first) + assert_equal('', error) end def test_option_v - cli_out_s, cli_err_s = results_for_cli_option('-v') - assert_match(/\d+\.\d+\.\d+/, cli_out_s) - assert_equal('', cli_err_s) + output, error = results_for_cli_option('-v') + assert_match(/\d+\.\d+\.\d+/, output) + assert_equal('', error) end end From 119e98c1fff6891d505feadf6b91da003c6dc96b Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Tue, 17 Dec 2024 18:01:43 -0600 Subject: [PATCH 12/27] Respond to review --- test/csv/csv-filter/test_csv_filter.rb | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index 0f5b46de..bc675ab1 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -1,14 +1,14 @@ # frozen_string_literal: false -require_relative '../helper' +require_relative "../helper" class TestFilter < Test::Unit::TestCase def setup @input = [ - %w[aaa bbb ccc].join(','), - %w[ddd eee fff].join(','), - '' # Force trailing newline. + %w[aaa bbb ccc].join(","), + %w[ddd eee fff].join(","), + "" # Force trailing newline. ].join("\n") end @@ -30,7 +30,7 @@ def run_csv_filter(filepath, *cli_option_names) File.join(top_dir, "bin", "csv-filter"), *cli_option_names, filepath, - ].join(' ') + ].join(" ") Tempfile.create("stdout", mode: File::RDWR) do |stdout| Tempfile.create("stderr", mode: File::RDWR) do |stderr| status = system(command_line, {1 => stdout, 2 => stderr}) @@ -43,11 +43,11 @@ def run_csv_filter(filepath, *cli_option_names) # Return results for CLI-only option (or invalid option). def results_for_cli_option(option_name) - output = '' - error = '' + output = "" + error = "" Dir.mktmpdir do |dirpath| sym = option_name.to_sym - filepath = csv_filepath('', dirpath, sym) + filepath = csv_filepath("", dirpath, sym) output, error = run_csv_filter(filepath, [option_name]) end [output, error] @@ -55,7 +55,7 @@ def results_for_cli_option(option_name) # Get and return the actual output from the API. def api_output(input, **api_options) - output = '' + output = "" CSV.filter(input, output, **api_options) {|row| } output end @@ -63,7 +63,7 @@ def api_output(input, **api_options) # Test for invalid option. def test_invalid_option - output, error = results_for_cli_option('-Z') + output, error = results_for_cli_option("-Z") assert_equal("", output) assert_match(/OptionParser::InvalidOption/, error) end @@ -78,15 +78,15 @@ def test_no_options # Tests for general options. def test_option_h - output, error = results_for_cli_option('-h') + output, error = results_for_cli_option("-h") assert_equal("Usage: csv-filter [options]\n", output.lines.first) - assert_equal('', error) + assert_equal("", error) end def test_option_v - output, error = results_for_cli_option('-v') + output, error = results_for_cli_option("-v") assert_match(/\d+\.\d+\.\d+/, output) - assert_equal('', error) + assert_equal("", error) end end From ebb8f48649899da1d3d60225c4855b38a18d274e Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Tue, 17 Dec 2024 19:01:11 -0600 Subject: [PATCH 13/27] Respond to review --- test/csv/csv-filter/test_csv_filter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index bc675ab1..0d931f06 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -33,7 +33,7 @@ def run_csv_filter(filepath, *cli_option_names) ].join(" ") Tempfile.create("stdout", mode: File::RDWR) do |stdout| Tempfile.create("stderr", mode: File::RDWR) do |stderr| - status = system(command_line, {1 => stdout, 2 => stderr}) + system(command_line, {1 => stdout, 2 => stderr}) stdout.rewind stderr.rewind [stdout.read, stderr.read] From 1776b21726b5c176c8ccbdb56697be5fca9071f6 Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Sat, 8 Feb 2025 10:11:44 -0600 Subject: [PATCH 14/27] Update test/csv/csv-filter/test_csv_filter.rb Co-authored-by: Sutou Kouhei --- test/csv/csv-filter/test_csv_filter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index 0d931f06..4561bbf2 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -30,7 +30,7 @@ def run_csv_filter(filepath, *cli_option_names) File.join(top_dir, "bin", "csv-filter"), *cli_option_names, filepath, - ].join(" ") + ] Tempfile.create("stdout", mode: File::RDWR) do |stdout| Tempfile.create("stderr", mode: File::RDWR) do |stderr| system(command_line, {1 => stdout, 2 => stderr}) From c3e960e2a89c66bf2b42087dab01c173568a980d Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Sat, 8 Feb 2025 10:12:21 -0600 Subject: [PATCH 15/27] Update test/csv/csv-filter/test_csv_filter.rb Co-authored-by: Sutou Kouhei --- test/csv/csv-filter/test_csv_filter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index 4561bbf2..95614241 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -33,7 +33,7 @@ def run_csv_filter(filepath, *cli_option_names) ] Tempfile.create("stdout", mode: File::RDWR) do |stdout| Tempfile.create("stderr", mode: File::RDWR) do |stderr| - system(command_line, {1 => stdout, 2 => stderr}) + system(command_line, out: stdout, err: stderr) stdout.rewind stderr.rewind [stdout.read, stderr.read] From 0658a059ce42bab1554cc6c4d1158fee6f13e78f Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Sat, 8 Feb 2025 10:12:45 -0600 Subject: [PATCH 16/27] Update test/csv/csv-filter/test_csv_filter.rb Co-authored-by: Sutou Kouhei --- test/csv/csv-filter/test_csv_filter.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index 95614241..576b5e14 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -3,7 +3,6 @@ require_relative "../helper" class TestFilter < Test::Unit::TestCase - def setup @input = [ %w[aaa bbb ccc].join(","), From b5cdca6383cfa7b80a36cb732b1e8134abc7273d Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Sat, 8 Feb 2025 10:13:02 -0600 Subject: [PATCH 17/27] Update test/csv/csv-filter/test_csv_filter.rb Co-authored-by: Sutou Kouhei --- test/csv/csv-filter/test_csv_filter.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index 576b5e14..91ed914e 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -87,5 +87,4 @@ def test_option_v assert_match(/\d+\.\d+\.\d+/, output) assert_equal("", error) end - end From ae72bb665a04cdc35fb9ad06981903c9ecc396f6 Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Sat, 8 Feb 2025 10:13:26 -0600 Subject: [PATCH 18/27] Update test/csv/csv-filter/test_csv_filter.rb Co-authored-by: Sutou Kouhei --- test/csv/csv-filter/test_csv_filter.rb | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index 91ed914e..32e004cf 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -42,14 +42,11 @@ def run_csv_filter(filepath, *cli_option_names) # Return results for CLI-only option (or invalid option). def results_for_cli_option(option_name) - output = "" - error = "" - Dir.mktmpdir do |dirpath| - sym = option_name.to_sym - filepath = csv_filepath("", dirpath, sym) - output, error = run_csv_filter(filepath, [option_name]) + Tempfile.create(["csv-filter", ".csv"]) do |file| + file.write(@input) + file.close + run_csv_filter(file.path, option_name) end - [output, error] end # Get and return the actual output from the API. From a63628deb0f4791f1c0d27c4d5c22beeb9fa1853 Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Sat, 8 Feb 2025 10:13:53 -0600 Subject: [PATCH 19/27] Update test/csv/csv-filter/test_csv_filter.rb Co-authored-by: Sutou Kouhei --- test/csv/csv-filter/test_csv_filter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index 32e004cf..846a8dd5 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -20,7 +20,7 @@ def csv_filepath(input, dirpath, option) end # Return stdout and stderr from CLI execution. - def run_csv_filter(filepath, *cli_option_names) + def run_csv_filter(filepath, *options) top_dir = File.join(__dir__, "..", "..", "..") command_line = [ Gem.ruby, From b176c635fdf743dc20377b6f6f3e00a66d7d2264 Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Sat, 8 Feb 2025 10:14:35 -0600 Subject: [PATCH 20/27] Update test/csv/csv-filter/test_csv_filter.rb Co-authored-by: Sutou Kouhei --- test/csv/csv-filter/test_csv_filter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index 846a8dd5..d0ad774d 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -50,7 +50,7 @@ def results_for_cli_option(option_name) end # Get and return the actual output from the API. - def api_output(input, **api_options) + def filter(input, **options) output = "" CSV.filter(input, output, **api_options) {|row| } output From 60ff6704569e7fd36b09ef11f0fe7f06791dd7f8 Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Sat, 8 Feb 2025 10:15:44 -0600 Subject: [PATCH 21/27] Update test/csv/csv-filter/test_csv_filter.rb Co-authored-by: Sutou Kouhei --- test/csv/csv-filter/test_csv_filter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index d0ad774d..4261e277 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -81,7 +81,7 @@ def test_option_h def test_option_v output, error = results_for_cli_option("-v") - assert_match(/\d+\.\d+\.\d+/, output) + assert_equal("${CSV::VERSION}\n", output) assert_equal("", error) end end From 31c2f2f0a62d68ebe2c32454da18a3a9cb3caac4 Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Sat, 8 Feb 2025 10:20:04 -0600 Subject: [PATCH 22/27] Update test/csv/csv-filter/test_csv_filter.rb Co-authored-by: Sutou Kouhei --- test/csv/csv-filter/test_csv_filter.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index 4261e277..1c51948a 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -75,8 +75,8 @@ def test_no_options def test_option_h output, error = results_for_cli_option("-h") - assert_equal("Usage: csv-filter [options]\n", output.lines.first) - assert_equal("", error) + assert_equal(["Usage: csv-filter [options]\n", ""], + [output.lines.first, error]) end def test_option_v From 2d67ff19c03fea07f18bbebcb759f78fc76a6daf Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Sat, 8 Feb 2025 11:53:01 -0600 Subject: [PATCH 23/27] Respond to review --- test/csv/csv-filter/test_csv_filter.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb index 1c51948a..beae3fef 100644 --- a/test/csv/csv-filter/test_csv_filter.rb +++ b/test/csv/csv-filter/test_csv_filter.rb @@ -27,9 +27,9 @@ def run_csv_filter(filepath, *options) "-I", File.join(top_dir, "lib"), File.join(top_dir, "bin", "csv-filter"), - *cli_option_names, + *options, filepath, - ] + ].join(' ') Tempfile.create("stdout", mode: File::RDWR) do |stdout| Tempfile.create("stderr", mode: File::RDWR) do |stderr| system(command_line, out: stdout, err: stderr) @@ -52,7 +52,7 @@ def results_for_cli_option(option_name) # Get and return the actual output from the API. def filter(input, **options) output = "" - CSV.filter(input, output, **api_options) {|row| } + CSV.filter(input, output, **options) {|row| } output end @@ -67,7 +67,7 @@ def test_invalid_option # Test for no options. def test_no_options - output = api_output(@input) + output = filter(@input) assert_equal(@input, output) end @@ -81,7 +81,7 @@ def test_option_h def test_option_v output, error = results_for_cli_option("-v") - assert_equal("${CSV::VERSION}\n", output) + assert_equal("#{CSV::VERSION}\n", output) assert_equal("", error) end end From ecd77d68ae351bc70fa71d6dd1647192779327e6 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Mon, 24 Feb 2025 18:10:16 +0900 Subject: [PATCH 24/27] Simplify --- bin/csv-filter | 12 ++-- test/csv/csv-filter/test_csv_filter.rb | 87 -------------------------- test/csv/test_csv_filter.rb | 62 ++++++++++++++++++ 3 files changed, 69 insertions(+), 92 deletions(-) mode change 100644 => 100755 bin/csv-filter delete mode 100644 test/csv/csv-filter/test_csv_filter.rb create mode 100644 test/csv/test_csv_filter.rb diff --git a/bin/csv-filter b/bin/csv-filter old mode 100644 new mode 100755 index 1a9326d7..9dab8f4e --- a/bin/csv-filter +++ b/bin/csv-filter @@ -14,13 +14,15 @@ Usage: #{parser.program_name} [options] Reads and parses the CSV text content of the standard input per the given input options. From that content, generates CSV text per the given output options and writes that text to the standard output. - BANNER -parser.separator('Generic Options') -parser.separator(nil) - -parser.parse! +begin + parser.parse! +rescue OptionParser::InvalidOption + $stderr.puts($!.message) + $stderr.puts(parser) + exit(false) +end CSV.filter(**options) do |row| end diff --git a/test/csv/csv-filter/test_csv_filter.rb b/test/csv/csv-filter/test_csv_filter.rb deleted file mode 100644 index beae3fef..00000000 --- a/test/csv/csv-filter/test_csv_filter.rb +++ /dev/null @@ -1,87 +0,0 @@ -# frozen_string_literal: false - -require_relative "../helper" - -class TestFilter < Test::Unit::TestCase - def setup - @input = [ - %w[aaa bbb ccc].join(","), - %w[ddd eee fff].join(","), - "" # Force trailing newline. - ].join("\n") - end - - # Return filepath of file containing CSV data. - def csv_filepath(input, dirpath, option) - filename = "#{option}.csv" - filepath = File.join(dirpath, filename) - File.write(filepath, input) - filepath - end - - # Return stdout and stderr from CLI execution. - def run_csv_filter(filepath, *options) - top_dir = File.join(__dir__, "..", "..", "..") - command_line = [ - Gem.ruby, - "-I", - File.join(top_dir, "lib"), - File.join(top_dir, "bin", "csv-filter"), - *options, - filepath, - ].join(' ') - Tempfile.create("stdout", mode: File::RDWR) do |stdout| - Tempfile.create("stderr", mode: File::RDWR) do |stderr| - system(command_line, out: stdout, err: stderr) - stdout.rewind - stderr.rewind - [stdout.read, stderr.read] - end - end - end - - # Return results for CLI-only option (or invalid option). - def results_for_cli_option(option_name) - Tempfile.create(["csv-filter", ".csv"]) do |file| - file.write(@input) - file.close - run_csv_filter(file.path, option_name) - end - end - - # Get and return the actual output from the API. - def filter(input, **options) - output = "" - CSV.filter(input, output, **options) {|row| } - output - end - - # Test for invalid option. - - def test_invalid_option - output, error = results_for_cli_option("-Z") - assert_equal("", output) - assert_match(/OptionParser::InvalidOption/, error) - end - - # Test for no options. - - def test_no_options - output = filter(@input) - assert_equal(@input, output) - end - - # Tests for general options. - - def test_option_h - output, error = results_for_cli_option("-h") - assert_equal(["Usage: csv-filter [options]\n", ""], - [output.lines.first, error]) - end - - def test_option_v - output, error = results_for_cli_option("-v") - assert_equal("#{CSV::VERSION}\n", output) - assert_equal("", error) - end -end diff --git a/test/csv/test_csv_filter.rb b/test/csv/test_csv_filter.rb new file mode 100644 index 00000000..ea20233d --- /dev/null +++ b/test/csv/test_csv_filter.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: false + +require_relative "helper" + +class TestCSVFilter < Test::Unit::TestCase + def setup + @csv = <<-CSV +aaa,bbb,ccc +ddd,eee,fff + CSV + end + + # Return stdout and stderr from CLI execution. + def run_csv_filter(csv, *options) + top_dir = File.join(__dir__, "..", "..") + command_line = [ + Gem.ruby, + "-I", + File.join(top_dir, "lib"), + File.join(top_dir, "bin", "csv-filter"), + *options, + ] + Tempfile.create("stdout", mode: File::RDWR) do |stdout| + Tempfile.create("stderr", mode: File::RDWR) do |stderr| + Tempfile.create(["csv-filter", ".csv"]) do |input| + input.write(csv) + input.close + system(*command_line, in: input.path, out: stdout, err: stderr) + stdout.rewind + stderr.rewind + [stdout.read, stderr.read] + end + end + end + end + + # Test for invalid option. + def test_invalid_option + output, error = run_csv_filter("", "-Z") + assert_equal(["", "invalid option: -Z\n"], + [output, error.lines.first]) + end + + # Test for no options. + def test_no_options + assert_equal([@csv, ""], + run_csv_filter(@csv)) + end + + # Tests for general options. + + def test_option_h + output, error = run_csv_filter("", "-h") + assert_equal(["Usage: csv-filter [options]\n", ""], + [output.lines.first, error]) + end + + def test_option_v + assert_equal(["csv-filter #{CSV::VERSION}\n", ""], + run_csv_filter("", "-v")) + end +end From 4befc445bae59170008cf6e30871ce8b5b0c4d0c Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Tue, 25 Feb 2025 05:43:00 +0900 Subject: [PATCH 25/27] Add to executables --- csv.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/csv.gemspec b/csv.gemspec index f5cf5827..f5ac1f07 100644 --- a/csv.gemspec +++ b/csv.gemspec @@ -38,6 +38,7 @@ Gem::Specification.new do |spec| end end spec.files = files + spec.executables = ["csv-filter"] spec.rdoc_options.concat(["--main", "README.md"]) rdoc_files = [ "LICENSE.txt", From cf863285acf20d10133c4149c076746d1191b832 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Tue, 25 Feb 2025 05:52:19 +0900 Subject: [PATCH 26/27] Use "csv-filter" for gem test --- test/csv/test_csv_filter.rb | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/test/csv/test_csv_filter.rb b/test/csv/test_csv_filter.rb index ea20233d..44a43c84 100644 --- a/test/csv/test_csv_filter.rb +++ b/test/csv/test_csv_filter.rb @@ -13,13 +13,25 @@ def setup # Return stdout and stderr from CLI execution. def run_csv_filter(csv, *options) top_dir = File.join(__dir__, "..", "..") - command_line = [ - Gem.ruby, - "-I", - File.join(top_dir, "lib"), - File.join(top_dir, "bin", "csv-filter"), - *options, - ] + csv_filter = File.join(top_dir, "bin", "csv-filter") + if File.exist?(csv_filter) + # Test in source + command_line = [ + Gem.ruby, + "-I", + File.join(top_dir, "lib"), + csv_filter, + *options, + ] + else + # Test installed csv gem + command_line = [ + Gem.ruby, + "-S", + "csv-filter", + *options, + ] + end Tempfile.create("stdout", mode: File::RDWR) do |stdout| Tempfile.create("stderr", mode: File::RDWR) do |stderr| Tempfile.create(["csv-filter", ".csv"]) do |input| From 0dc677738f33f9f3a2a39d102942769ec2dfcd2f Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Tue, 25 Feb 2025 05:56:41 +0900 Subject: [PATCH 27/27] Improve comment --- test/csv/test_csv_filter.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/csv/test_csv_filter.rb b/test/csv/test_csv_filter.rb index 44a43c84..20fbe2af 100644 --- a/test/csv/test_csv_filter.rb +++ b/test/csv/test_csv_filter.rb @@ -15,7 +15,7 @@ def run_csv_filter(csv, *options) top_dir = File.join(__dir__, "..", "..") csv_filter = File.join(top_dir, "bin", "csv-filter") if File.exist?(csv_filter) - # Test in source + # In-place test command_line = [ Gem.ruby, "-I", @@ -24,7 +24,7 @@ def run_csv_filter(csv, *options) *options, ] else - # Test installed csv gem + # Gem test command_line = [ Gem.ruby, "-S",