Skip to content

Commit

Permalink
Respond to review
Browse files Browse the repository at this point in the history
  • Loading branch information
BurdetteLamar committed Dec 18, 2024
1 parent cdc2b47 commit 119e98c
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions test/csv/csv-filter/test_csv_filter.rb
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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})
Expand All @@ -43,27 +43,27 @@ 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]
end

# 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

# 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
Expand All @@ -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

0 comments on commit 119e98c

Please sign in to comment.