Skip to content

Instantly share code, notes, and snippets.

@284km
Created December 8, 2018 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 284km/ce8028f59e820e29a475cffbcd6f1d99 to your computer and use it in GitHub Desktop.
Save 284km/ce8028f59e820e29a475cffbcd6f1d99 to your computer and use it in GitHub Desktop.
ccsv は速いけど単純に ruby/csv と比較できなかった.md

result

Run options: 

# Running tests:


  1) Failure:
TestCSV::Parsing::DifferentOFS#test_the_parse_fails_fast_when_it_can_for_unquoted_fields [/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:200]:
[CSV::MalformedCSVError] exception expected, not.
Class: <NoMethodError>
Message: <"undefined method `parse' for Ccsv:Class">
---Backtrace---
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:261:in `block (2 levels) in assert_parse_errors_out'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:260:in `block in assert_parse_errors_out'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit/assertions.rb:74:in `assert_raise'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:259:in `assert_parse_errors_out'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:200:in `test_the_parse_fails_fast_when_it_can_for_unquoted_fields'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit.rb:1166:in `run_test'
---------------

  2) Failure:
TestCSV::Parsing#test_field_size_limit_in_extended_column_exceeding [/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:231]:
[CSV::MalformedCSVError] exception expected, not.
Class: <NoMethodError>
Message: <"undefined method `parse' for Ccsv:Class">
---Backtrace---
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:261:in `block (2 levels) in assert_parse_errors_out'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:260:in `block in assert_parse_errors_out'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit/assertions.rb:74:in `assert_raise'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:259:in `assert_parse_errors_out'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:231:in `test_field_size_limit_in_extended_column_exceeding'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit.rb:1166:in `run_test'
---------------

  3) Failure:
TestCSV::Parsing#test_malformed_csv [/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:149]:
[CSV::MalformedCSVError] exception expected, not.
Class: <NoMethodError>
Message: <"undefined method `parse_line' for Ccsv:Class">
---Backtrace---
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:150:in `block in test_malformed_csv'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit/assertions.rb:74:in `assert_raise'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:149:in `test_malformed_csv'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit.rb:1166:in `run_test'
---------------

  4) Failure:
TestCSV::Parsing#test_field_size_limit_controls_lookahead [/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:208]:
[CSV::MalformedCSVError] exception expected, not.
Class: <NoMethodError>
Message: <"undefined method `parse' for Ccsv:Class">
---Backtrace---
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:261:in `block (2 levels) in assert_parse_errors_out'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:260:in `block in assert_parse_errors_out'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit/assertions.rb:74:in `assert_raise'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:259:in `assert_parse_errors_out'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:208:in `test_field_size_limit_controls_lookahead'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit.rb:1166:in `run_test'
---------------

  5) Failure:
TestCSV::Parsing::DifferentOFS#test_field_size_limit_controls_lookahead [/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:208]:
[CSV::MalformedCSVError] exception expected, not.
Class: <NoMethodError>
Message: <"undefined method `parse' for Ccsv:Class">
---Backtrace---
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:261:in `block (2 levels) in assert_parse_errors_out'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:260:in `block in assert_parse_errors_out'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit/assertions.rb:74:in `assert_raise'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:259:in `assert_parse_errors_out'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:208:in `test_field_size_limit_controls_lookahead'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit.rb:1166:in `run_test'
---------------

  6) Failure:
TestCSV::Parsing::DifferentOFS#test_field_size_limit_in_extended_column_exceeding [/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:231]:
[CSV::MalformedCSVError] exception expected, not.
Class: <NoMethodError>
Message: <"undefined method `parse' for Ccsv:Class">
---Backtrace---
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:261:in `block (2 levels) in assert_parse_errors_out'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:260:in `block in assert_parse_errors_out'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit/assertions.rb:74:in `assert_raise'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:259:in `assert_parse_errors_out'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:231:in `test_field_size_limit_in_extended_column_exceeding'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit.rb:1166:in `run_test'
---------------

  7) Failure:
TestCSV::Parsing#test_the_parse_fails_fast_when_it_can_for_unescaped_quotes [/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:204]:
[CSV::MalformedCSVError] exception expected, not.
Class: <NoMethodError>
Message: <"undefined method `parse' for Ccsv:Class">
---Backtrace---
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:261:in `block (2 levels) in assert_parse_errors_out'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:260:in `block in assert_parse_errors_out'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit/assertions.rb:74:in `assert_raise'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:259:in `assert_parse_errors_out'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:204:in `test_the_parse_fails_fast_when_it_can_for_unescaped_quotes'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit.rb:1166:in `run_test'
---------------

  8) Failure:
TestCSV::Parsing#test_the_parse_fails_fast_when_it_can_for_unquoted_fields [/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:200]:
[CSV::MalformedCSVError] exception expected, not.
Class: <NoMethodError>
Message: <"undefined method `parse' for Ccsv:Class">
---Backtrace---
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:261:in `block (2 levels) in assert_parse_errors_out'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:260:in `block in assert_parse_errors_out'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit/assertions.rb:74:in `assert_raise'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:259:in `assert_parse_errors_out'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:200:in `test_the_parse_fails_fast_when_it_can_for_unquoted_fields'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit.rb:1166:in `run_test'
---------------

  9) Failure:
TestCSV::Parsing::DifferentOFS#test_the_parse_fails_fast_when_it_can_for_unescaped_quotes [/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:204]:
[CSV::MalformedCSVError] exception expected, not.
Class: <NoMethodError>
Message: <"undefined method `parse' for Ccsv:Class">
---Backtrace---
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:261:in `block (2 levels) in assert_parse_errors_out'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/Users/kazuma.furuhashi/.rbenv/versions/2.6.0-preview3/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:260:in `block in assert_parse_errors_out'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit/assertions.rb:74:in `assert_raise'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:259:in `assert_parse_errors_out'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:204:in `test_the_parse_fails_fast_when_it_can_for_unescaped_quotes'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit.rb:1166:in `run_test'
---------------

 10) Failure:
TestCSV::Parsing::DifferentOFS#test_malformed_csv [/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:149]:
[CSV::MalformedCSVError] exception expected, not.
Class: <NoMethodError>
Message: <"undefined method `parse_line' for Ccsv:Class">
---Backtrace---
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:150:in `block in test_malformed_csv'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit/assertions.rb:74:in `assert_raise'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:149:in `test_malformed_csv'
/Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit.rb:1166:in `run_test'
---------------

 11) Error:
TestCSV::Parsing#test_row_sep_auto_lf:
NoMethodError: undefined method `parse' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:249:in `test_row_sep_auto_lf'

 12) Error:
TestCSV::Parsing#test_std_lib_csv:
NoMethodError: undefined method `parse_line' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:62:in `block in test_std_lib_csv'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:61:in `each'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:61:in `test_std_lib_csv'

 13) Error:
TestCSV::Parsing#test_aras_edge_cases:
NoMethodError: undefined method `parse_line' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:104:in `block in test_aras_edge_cases'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:103:in `each'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:103:in `test_aras_edge_cases'

 14) Error:
TestCSV::Parsing::DifferentOFS#test_col_sep_comma:
NoMethodError: undefined method `parse' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:236:in `test_col_sep_comma'

 15) Error:
TestCSV::Parsing::DifferentOFS#test_col_sep_space:
NoMethodError: undefined method `parse' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:241:in `test_col_sep_space'

 16) Error:
TestCSV::Parsing::DifferentOFS#test_field_size_limit_in_extended_column_not_exceeding:
NoMethodError: undefined method `parse' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:220:in `block in test_field_size_limit_in_extended_column_not_exceeding'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit/assertions.rb:177:in `assert_nothing_raised'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:219:in `test_field_size_limit_in_extended_column_not_exceeding'

 17) Error:
TestCSV::Parsing::DifferentOFS#test_james_edge_cases:
NoMethodError: undefined method `parse_line' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:110:in `test_james_edge_cases'

 18) Error:
TestCSV::Parsing::DifferentOFS#test_mastering_regex_example:
NoMethodError: undefined method `parse_line' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:30:in `test_mastering_regex_example'

 19) Error:
TestCSV::Parsing::DifferentOFS#test_non_regex_edge_cases:
NoMethodError: undefined method `parse_line' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:140:in `block in test_non_regex_edge_cases'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:139:in `each'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:139:in `test_non_regex_edge_cases'

 20) Error:
TestCSV::Parsing::DifferentOFS#test_rob_edge_cases:
NoMethodError: undefined method `parse_line' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:132:in `block in test_rob_edge_cases'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:131:in `each'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:131:in `test_rob_edge_cases'

 21) Error:
TestCSV::Parsing::DifferentOFS#test_row_sep_auto_cr:
NoMethodError: undefined method `parse' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:245:in `test_row_sep_auto_cr'

 22) Error:
TestCSV::Parsing::DifferentOFS#test_row_sep_auto_cr_lf:
NoMethodError: undefined method `parse' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:253:in `test_row_sep_auto_cr_lf'

 23) Error:
TestCSV::Parsing::DifferentOFS#test_row_sep_auto_lf:
NoMethodError: undefined method `parse' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:249:in `test_row_sep_auto_lf'

 24) Error:
TestCSV::Parsing::DifferentOFS#test_std_lib_csv:
NoMethodError: undefined method `parse_line' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:62:in `block in test_std_lib_csv'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:61:in `each'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:61:in `test_std_lib_csv'

 25) Error:
TestCSV::Parsing::DifferentOFS#test_aras_edge_cases:
NoMethodError: undefined method `parse_line' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:104:in `block in test_aras_edge_cases'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:103:in `each'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:103:in `test_aras_edge_cases'

 26) Error:
TestCSV::Parsing#test_col_sep_comma:
NoMethodError: undefined method `parse' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:236:in `test_col_sep_comma'

 27) Error:
TestCSV::Parsing#test_col_sep_space:
NoMethodError: undefined method `parse' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:241:in `test_col_sep_space'

 28) Error:
TestCSV::Parsing#test_field_size_limit_in_extended_column_not_exceeding:
NoMethodError: undefined method `parse' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:220:in `block in test_field_size_limit_in_extended_column_not_exceeding'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/lib/test/unit/assertions.rb:177:in `assert_nothing_raised'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:219:in `test_field_size_limit_in_extended_column_not_exceeding'

 29) Error:
TestCSV::Parsing#test_james_edge_cases:
NoMethodError: undefined method `parse_line' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:110:in `test_james_edge_cases'

 30) Error:
TestCSV::Parsing#test_mastering_regex_example:
NoMethodError: undefined method `parse_line' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:30:in `test_mastering_regex_example'

 31) Error:
TestCSV::Parsing#test_non_regex_edge_cases:
NoMethodError: undefined method `parse_line' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:140:in `block in test_non_regex_edge_cases'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:139:in `each'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:139:in `test_non_regex_edge_cases'

 32) Error:
TestCSV::Parsing#test_rob_edge_cases:
NoMethodError: undefined method `parse_line' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:132:in `block in test_rob_edge_cases'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:131:in `each'
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:131:in `test_rob_edge_cases'

 33) Error:
TestCSV::Parsing#test_row_sep_auto_cr:
NoMethodError: undefined method `parse' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:245:in `test_row_sep_auto_cr'

 34) Error:
TestCSV::Parsing#test_row_sep_auto_cr_lf:
NoMethodError: undefined method `parse' for Ccsv:Class
    /Users/kazuma.furuhashi/src/github.com/284km/csv/test/csv/test_csv_parsing.rb:253:in `test_row_sep_auto_cr_lf'

Finished tests in 0.031251s, 1087.9652 tests/s, 383.9877 assertions/s.
34 tests, 12 assertions, 10 failures, 24 errors, 0 skips

ruby -v: ruby 2.6.0preview3 (2018-11-06 trunk 65578) [x86_64-darwin17]

test code

#!/usr/bin/env ruby -w
# encoding: UTF-8
# frozen_string_literal: false

# tc_csv_parsing.rb
#
# Created by James Edward Gray II on 2005-10-31.

require "timeout"

require_relative "base"

require 'ccsv'

#
# Following tests are my interpretation of the
# {CSV RCF}[http://www.ietf.org/rfc/rfc4180.txt].  I only deviate from that
# document in one place (intentionally) and that is to make the default row
# separator <tt>$/</tt>.
#
class TestCSV::Parsing < TestCSV
  extend DifferentOFS

  BIG_DATA = "123456789\n" * 1024

  def test_mastering_regex_example
    ex = %Q{Ten Thousand,10000, 2710 ,,"10,000","It's ""10 Grand"", baby",10K}
    assert_equal( [ "Ten Thousand", "10000", " 2710 ", nil, "10,000",
                    "It's \"10 Grand\", baby", "10K" ],
                  Ccsv.parse_line(ex) )
  end

  # Old Ruby 1.8 CSV library tests.
  def test_std_lib_csv
    [ ["\t", ["\t"]],
      ["foo,\"\"\"\"\"\",baz", ["foo", "\"\"", "baz"]],
      ["foo,\"\"\"bar\"\"\",baz", ["foo", "\"bar\"", "baz"]],
      ["\"\"\"\n\",\"\"\"\n\"", ["\"\n", "\"\n"]],
      ["foo,\"\r\n\",baz", ["foo", "\r\n", "baz"]],
      ["\"\"", [""]],
      ["foo,\"\"\"\",baz", ["foo", "\"", "baz"]],
      ["foo,\"\r.\n\",baz", ["foo", "\r.\n", "baz"]],
      ["foo,\"\r\",baz", ["foo", "\r", "baz"]],
      ["foo,\"\",baz", ["foo", "", "baz"]],
      ["\",\"", [","]],
      ["foo", ["foo"]],
      [",,", [nil, nil, nil]],
      [",", [nil, nil]],
      ["foo,\"\n\",baz", ["foo", "\n", "baz"]],
      ["foo,,baz", ["foo", nil, "baz"]],
      ["\"\"\"\r\",\"\"\"\r\"", ["\"\r", "\"\r"]],
      ["\",\",\",\"", [",", ","]],
      ["foo,bar,", ["foo", "bar", nil]],
      [",foo,bar", [nil, "foo", "bar"]],
      ["foo,bar", ["foo", "bar"]],
      [";", [";"]],
      ["\t,\t", ["\t", "\t"]],
      ["foo,\"\r\n\r\",baz", ["foo", "\r\n\r", "baz"]],
      ["foo,\"\r\n\n\",baz", ["foo", "\r\n\n", "baz"]],
      ["foo,\"foo,bar\",baz", ["foo", "foo,bar", "baz"]],
      [";,;", [";", ";"]] ].each do |csv_test|
      assert_equal(csv_test.last, Ccsv.parse_line(csv_test.first))
    end

    [ ["foo,\"\"\"\"\"\",baz", ["foo", "\"\"", "baz"]],
      ["foo,\"\"\"bar\"\"\",baz", ["foo", "\"bar\"", "baz"]],
      ["foo,\"\r\n\",baz", ["foo", "\r\n", "baz"]],
      ["\"\"", [""]],
      ["foo,\"\"\"\",baz", ["foo", "\"", "baz"]],
      ["foo,\"\r.\n\",baz", ["foo", "\r.\n", "baz"]],
      ["foo,\"\r\",baz", ["foo", "\r", "baz"]],
      ["foo,\"\",baz", ["foo", "", "baz"]],
      ["foo", ["foo"]],
      [",,", [nil, nil, nil]],
      [",", [nil, nil]],
      ["foo,\"\n\",baz", ["foo", "\n", "baz"]],
      ["foo,,baz", ["foo", nil, "baz"]],
      ["foo,bar", ["foo", "bar"]],
      ["foo,\"\r\n\n\",baz", ["foo", "\r\n\n", "baz"]],
      ["foo,\"foo,bar\",baz", ["foo", "foo,bar", "baz"]] ].each do |csv_test|
      assert_equal(csv_test.last, Ccsv.parse_line(csv_test.first))
    end
  end

  # From:  http://ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-core/6496
  def test_aras_edge_cases
    [ [%Q{a,b},               ["a", "b"]],
      [%Q{a,"""b"""},         ["a", "\"b\""]],
      [%Q{a,"""b"},           ["a", "\"b"]],
      [%Q{a,"b"""},           ["a", "b\""]],
      [%Q{a,"\nb"""},         ["a", "\nb\""]],
      [%Q{a,"""\nb"},         ["a", "\"\nb"]],
      [%Q{a,"""\nb\n"""},     ["a", "\"\nb\n\""]],
      [%Q{a,"""\nb\n""",\nc}, ["a", "\"\nb\n\"", nil]],
      [%Q{a,,,},              ["a", nil, nil, nil]],
      [%Q{,},                 [nil, nil]],
      [%Q{"",""},             ["", ""]],
      [%Q{""""},              ["\""]],
      [%Q{"""",""},           ["\"",""]],
      [%Q{,""},               [nil,""]],
      [%Q{,"\r"},             [nil,"\r"]],
      [%Q{"\r\n,"},           ["\r\n,"]],
      [%Q{"\r\n,",},          ["\r\n,", nil]] ].each do |edge_case|
        assert_equal(edge_case.last, Ccsv.parse_line(edge_case.first))
      end
  end

  def test_james_edge_cases
    # A read at eof? should return nil.
    assert_equal(nil, Ccsv.parse_line(""))
    #
    # With Ruby 1.8 CSV it's impossible to tell an empty line from a line
    # containing a single +nil+ field.  The old CSV library returns
    # <tt>[nil]</tt> in these cases, but <tt>Array.new</tt> makes more sense to
    # me.
    #
    assert_equal(Array.new, Ccsv.parse_line("\n1,2,3\n"))
  end

  def test_rob_edge_cases
    [ [%Q{"a\nb"},                         ["a\nb"]],
      [%Q{"\n\n\n"},                       ["\n\n\n"]],
      [%Q{a,"b\n\nc"},                     ['a', "b\n\nc"]],
      [%Q{,"\r\n"},                        [nil,"\r\n"]],
      [%Q{,"\r\n."},                       [nil,"\r\n."]],
      [%Q{"a\na","one newline"},           ["a\na", 'one newline']],
      [%Q{"a\n\na","two newlines"},        ["a\n\na", 'two newlines']],
      [%Q{"a\r\na","one CRLF"},            ["a\r\na", 'one CRLF']],
      [%Q{"a\r\n\r\na","two CRLFs"},       ["a\r\n\r\na", 'two CRLFs']],
      [%Q{with blank,"start\n\nfinish"\n}, ['with blank', "start\n\nfinish"]],
    ].each do |edge_case|
      assert_equal(edge_case.last, Ccsv.parse_line(edge_case.first))
    end
  end

  def test_non_regex_edge_cases
    # An early version of the non-regex parser fails this test
    [ [ "foo,\"foo,bar,baz,foo\",\"foo\"",
        ["foo", "foo,bar,baz,foo", "foo"] ] ].each do |edge_case|
      assert_equal(edge_case.last, Ccsv.parse_line(edge_case.first))
    end

    assert_raise(CSV::MalformedCSVError) do
      Ccsv.parse_line("1,\"23\"4\"5\", 6")
    end
  end

  def test_malformed_csv
    assert_raise(CSV::MalformedCSVError) do
      Ccsv.parse_line("1,2\r,3", row_sep: "\n")
    end

    bad_data = <<-CSV
line,1,abc
line,2,"def\nghi"

line,4,some\rjunk
line,5,jkl
    CSV
    lines = bad_data.lines.to_a
    assert_equal(6, lines.size)
    assert_match(/\Aline,4/, lines.find { |l| l =~ /some\rjunk/ })

    csv = Ccsv.new(bad_data)
    begin
      loop do
        assert_not_nil(Ccsv.shift)
        assert_send([Ccsv.lineno, :<, 4])
      end
    rescue CSV::MalformedCSVError
      assert_equal( "Unquoted fields do not allow \\r or \\n in line 4.",
                    $!.message )
    end

    assert_raise(CSV::MalformedCSVError) { Ccsv.parse_line('1,2,"3...') }

    bad_data = <<-CSV
line,1,abc
line,2,"def\nghi"

line,4,8'10"
line,5,jkl
    CSV
    lines = bad_data.lines.to_a
    assert_equal(6, lines.size)
    assert_match(/\Aline,4/, lines.find { |l| l =~ /8'10"/ })

    csv = Ccsv.new(bad_data)
    begin
      loop do
        assert_not_nil(Ccsv.shift)
        assert_send([Ccsv.lineno, :<, 4])
      end
    rescue CSV::MalformedCSVError
      assert_equal("Illegal quoting in line 4.", $!.message)
    end
  end

  def test_the_parse_fails_fast_when_it_can_for_unquoted_fields
    assert_parse_errors_out('valid,fields,bad start"' + BIG_DATA)
  end

  def test_the_parse_fails_fast_when_it_can_for_unescaped_quotes
    assert_parse_errors_out('valid,fields,"bad start"unescaped' + BIG_DATA)
  end

  def test_field_size_limit_controls_lookahead
    assert_parse_errors_out( 'valid,fields,"' + BIG_DATA + '"',
                             field_size_limit: 2048 )
  end

  def test_field_size_limit_in_extended_column_not_exceeding
    data = <<~DATA
      "a","b"
      "
      2
      ",""
    DATA
    assert_nothing_raised(CSV::MalformedCSVError) do
      Ccsv.parse(data, field_size_limit: 4)
    end
  end

  def test_field_size_limit_in_extended_column_exceeding
    data = <<~DATA
      "a","b"
      "
      2345
      ",""
    DATA
    assert_parse_errors_out(data, field_size_limit: 5)
  end

  def test_col_sep_comma
    assert_equal([["a", "b", nil, "d"]],
                 Ccsv.parse("a,b,,d", col_sep: ","))
  end

  def test_col_sep_space
    assert_equal([["a", "b", nil, "d"]],
                 Ccsv.parse("a b  d", col_sep: " "))
  end

  def test_row_sep_auto_cr
    assert_equal([["a"]], Ccsv.parse("a\r"))
  end

  def test_row_sep_auto_lf
    assert_equal([["a"]], Ccsv.parse("a\n"))
  end

  def test_row_sep_auto_cr_lf
    assert_equal([["a"]], Ccsv.parse("a\r\n"))
  end

  private

  def assert_parse_errors_out(*args)
    assert_raise(CSV::MalformedCSVError) do
      Timeout.timeout(0.2) do
        Ccsv.parse(*args)
        fail("Parse didn't error out")
      end
    end
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment