11# frozen_string_literal: false
22
3- require_relative ' ../helper'
3+ require_relative " ../helper"
44
55class TestFilter < Test ::Unit ::TestCase
66
77 def setup
88 @input = [
9- %w[ aaa bbb ccc ] . join ( ',' ) ,
10- %w[ ddd eee fff ] . join ( ',' ) ,
11- '' # Force trailing newline.
9+ %w[ aaa bbb ccc ] . join ( "," ) ,
10+ %w[ ddd eee fff ] . join ( "," ) ,
11+ "" # Force trailing newline.
1212 ] . join ( "\n " )
1313 end
1414
@@ -30,7 +30,7 @@ def run_csv_filter(filepath, *cli_option_names)
3030 File . join ( top_dir , "bin" , "csv-filter" ) ,
3131 *cli_option_names ,
3232 filepath ,
33- ] . join ( ' ' )
33+ ] . join ( " " )
3434 Tempfile . create ( "stdout" , mode : File ::RDWR ) do |stdout |
3535 Tempfile . create ( "stderr" , mode : File ::RDWR ) do |stderr |
3636 status = system ( command_line , { 1 => stdout , 2 => stderr } )
@@ -43,27 +43,27 @@ def run_csv_filter(filepath, *cli_option_names)
4343
4444 # Return results for CLI-only option (or invalid option).
4545 def results_for_cli_option ( option_name )
46- output = ''
47- error = ''
46+ output = ""
47+ error = ""
4848 Dir . mktmpdir do |dirpath |
4949 sym = option_name . to_sym
50- filepath = csv_filepath ( '' , dirpath , sym )
50+ filepath = csv_filepath ( "" , dirpath , sym )
5151 output , error = run_csv_filter ( filepath , [ option_name ] )
5252 end
5353 [ output , error ]
5454 end
5555
5656 # Get and return the actual output from the API.
5757 def api_output ( input , **api_options )
58- output = ''
58+ output = ""
5959 CSV . filter ( input , output , **api_options ) { |row | }
6060 output
6161 end
6262
6363 # Test for invalid option.
6464
6565 def test_invalid_option
66- output , error = results_for_cli_option ( '-Z' )
66+ output , error = results_for_cli_option ( "-Z" )
6767 assert_equal ( "" , output )
6868 assert_match ( /OptionParser::InvalidOption/ , error )
6969 end
@@ -78,15 +78,15 @@ def test_no_options
7878 # Tests for general options.
7979
8080 def test_option_h
81- output , error = results_for_cli_option ( '-h' )
81+ output , error = results_for_cli_option ( "-h" )
8282 assert_equal ( "Usage: csv-filter [options]\n " , output . lines . first )
83- assert_equal ( '' , error )
83+ assert_equal ( "" , error )
8484 end
8585
8686 def test_option_v
87- output , error = results_for_cli_option ( '-v' )
87+ output , error = results_for_cli_option ( "-v" )
8888 assert_match ( /\d +\. \d +\. \d +/ , output )
89- assert_equal ( '' , error )
89+ assert_equal ( "" , error )
9090 end
9191
9292end
0 commit comments