From f2dce4e6e07abf632357ac105f4ed201e4ee9781 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Mon, 22 Jan 2024 17:23:33 +0900 Subject: [PATCH] spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ""..."3.4"' spec/ruby/library/csv/**/*.rb --- .../basicwriter/close_on_terminate_spec.rb | 9 +- .../csv/basicwriter/initialize_spec.rb | 9 +- .../library/csv/basicwriter/terminate_spec.rb | 9 +- spec/ruby/library/csv/cell/data_spec.rb | 9 +- spec/ruby/library/csv/cell/initialize_spec.rb | 9 +- spec/ruby/library/csv/foreach_spec.rb | 9 +- spec/ruby/library/csv/generate_line_spec.rb | 45 +++--- spec/ruby/library/csv/generate_row_spec.rb | 9 +- spec/ruby/library/csv/generate_spec.rb | 47 +++--- spec/ruby/library/csv/iobuf/close_spec.rb | 9 +- .../ruby/library/csv/iobuf/initialize_spec.rb | 9 +- spec/ruby/library/csv/iobuf/read_spec.rb | 9 +- spec/ruby/library/csv/iobuf/terminate_spec.rb | 9 +- .../csv/ioreader/close_on_terminate_spec.rb | 9 +- .../ruby/library/csv/ioreader/get_row_spec.rb | 9 +- .../library/csv/ioreader/initialize_spec.rb | 9 +- .../library/csv/ioreader/terminate_spec.rb | 9 +- spec/ruby/library/csv/liberal_parsing_spec.rb | 29 ++-- spec/ruby/library/csv/open_spec.rb | 9 +- spec/ruby/library/csv/parse_spec.rb | 147 +++++++++--------- spec/ruby/library/csv/read_spec.rb | 9 +- spec/ruby/library/csv/readlines_spec.rb | 53 ++++--- .../library/csv/streambuf/add_buf_spec.rb | 9 +- .../library/csv/streambuf/buf_size_spec.rb | 9 +- spec/ruby/library/csv/streambuf/drop_spec.rb | 9 +- .../csv/streambuf/element_reference_spec.rb | 9 +- spec/ruby/library/csv/streambuf/get_spec.rb | 9 +- .../library/csv/streambuf/idx_is_eos_spec.rb | 9 +- .../library/csv/streambuf/initialize_spec.rb | 9 +- .../ruby/library/csv/streambuf/is_eos_spec.rb | 9 +- spec/ruby/library/csv/streambuf/read_spec.rb | 9 +- .../library/csv/streambuf/rel_buf_spec.rb | 9 +- .../library/csv/streambuf/terminate_spec.rb | 9 +- .../library/csv/stringreader/get_row_spec.rb | 9 +- .../csv/stringreader/initialize_spec.rb | 9 +- spec/ruby/library/csv/writer/add_row_spec.rb | 9 +- spec/ruby/library/csv/writer/append_spec.rb | 9 +- spec/ruby/library/csv/writer/close_spec.rb | 9 +- spec/ruby/library/csv/writer/create_spec.rb | 9 +- spec/ruby/library/csv/writer/generate_spec.rb | 9 +- .../library/csv/writer/initialize_spec.rb | 9 +- .../ruby/library/csv/writer/terminate_spec.rb | 9 +- 42 files changed, 390 insertions(+), 264 deletions(-) diff --git a/spec/ruby/library/csv/basicwriter/close_on_terminate_spec.rb b/spec/ruby/library/csv/basicwriter/close_on_terminate_spec.rb index 599e640624..d3f667c602 100644 --- a/spec/ruby/library/csv/basicwriter/close_on_terminate_spec.rb +++ b/spec/ruby/library/csv/basicwriter/close_on_terminate_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::BasicWriter#close_on_terminate" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::BasicWriter#close_on_terminate" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/basicwriter/initialize_spec.rb b/spec/ruby/library/csv/basicwriter/initialize_spec.rb index 2c13c93f2e..af86bc177b 100644 --- a/spec/ruby/library/csv/basicwriter/initialize_spec.rb +++ b/spec/ruby/library/csv/basicwriter/initialize_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::BasicWriter#initialize" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::BasicWriter#initialize" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/basicwriter/terminate_spec.rb b/spec/ruby/library/csv/basicwriter/terminate_spec.rb index 8c53db3f0b..5396295a61 100644 --- a/spec/ruby/library/csv/basicwriter/terminate_spec.rb +++ b/spec/ruby/library/csv/basicwriter/terminate_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::BasicWriter#terminate" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::BasicWriter#terminate" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/cell/data_spec.rb b/spec/ruby/library/csv/cell/data_spec.rb index aa034b0b62..14f49ace96 100644 --- a/spec/ruby/library/csv/cell/data_spec.rb +++ b/spec/ruby/library/csv/cell/data_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::Cell#data" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::Cell#data" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/cell/initialize_spec.rb b/spec/ruby/library/csv/cell/initialize_spec.rb index c9e506676c..ff3ac55470 100644 --- a/spec/ruby/library/csv/cell/initialize_spec.rb +++ b/spec/ruby/library/csv/cell/initialize_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::Cell#initialize" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::Cell#initialize" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/foreach_spec.rb b/spec/ruby/library/csv/foreach_spec.rb index 36b3cd152f..c8aa1b8009 100644 --- a/spec/ruby/library/csv/foreach_spec.rb +++ b/spec/ruby/library/csv/foreach_spec.rb @@ -1,6 +1,9 @@ require_relative '../../spec_helper' -require 'csv' -describe "CSV.foreach" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV.foreach" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/generate_line_spec.rb b/spec/ruby/library/csv/generate_line_spec.rb index 656365b109..0830bbdb63 100644 --- a/spec/ruby/library/csv/generate_line_spec.rb +++ b/spec/ruby/library/csv/generate_line_spec.rb @@ -1,30 +1,33 @@ require_relative '../../spec_helper' -require 'csv' -describe "CSV.generate_line" do +ruby_version_is ""..."3.4" do + require 'csv' - it "generates an empty string" do - result = CSV.generate_line([]) - result.should == "\n" - end + describe "CSV.generate_line" do - it "generates the string 'foo,bar'" do - result = CSV.generate_line(["foo", "bar"]) - result.should == "foo,bar\n" - end + it "generates an empty string" do + result = CSV.generate_line([]) + result.should == "\n" + end - it "generates the string 'foo;bar'" do - result = CSV.generate_line(["foo", "bar"], col_sep: ?;) - result.should == "foo;bar\n" - end + it "generates the string 'foo,bar'" do + result = CSV.generate_line(["foo", "bar"]) + result.should == "foo,bar\n" + end - it "generates the string 'foo,,bar'" do - result = CSV.generate_line(["foo", nil, "bar"]) - result.should == "foo,,bar\n" - end + it "generates the string 'foo;bar'" do + result = CSV.generate_line(["foo", "bar"], col_sep: ?;) + result.should == "foo;bar\n" + end - it "generates the string 'foo;;bar'" do - result = CSV.generate_line(["foo", nil, "bar"], col_sep: ?;) - result.should == "foo;;bar\n" + it "generates the string 'foo,,bar'" do + result = CSV.generate_line(["foo", nil, "bar"]) + result.should == "foo,,bar\n" + end + + it "generates the string 'foo;;bar'" do + result = CSV.generate_line(["foo", nil, "bar"], col_sep: ?;) + result.should == "foo;;bar\n" + end end end diff --git a/spec/ruby/library/csv/generate_row_spec.rb b/spec/ruby/library/csv/generate_row_spec.rb index 79dfc34000..aff5332a9e 100644 --- a/spec/ruby/library/csv/generate_row_spec.rb +++ b/spec/ruby/library/csv/generate_row_spec.rb @@ -1,6 +1,9 @@ require_relative '../../spec_helper' -require 'csv' -describe "CSV.generate_row" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV.generate_row" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/generate_spec.rb b/spec/ruby/library/csv/generate_spec.rb index 0a1e3d9604..de476d437f 100644 --- a/spec/ruby/library/csv/generate_spec.rb +++ b/spec/ruby/library/csv/generate_spec.rb @@ -1,32 +1,35 @@ require_relative '../../spec_helper' -require 'csv' -require 'tempfile' -describe "CSV.generate" do +ruby_version_is ""..."3.4" do + require 'csv' + require 'tempfile' - it "returns CSV string" do - csv_str = CSV.generate do |csv| - csv.add_row [1, 2, 3] - csv << [4, 5, 6] + describe "CSV.generate" do + + it "returns CSV string" do + csv_str = CSV.generate do |csv| + csv.add_row [1, 2, 3] + csv << [4, 5, 6] + end + csv_str.should == "1,2,3\n4,5,6\n" end - csv_str.should == "1,2,3\n4,5,6\n" - end - it "accepts a col separator" do - csv_str = CSV.generate(col_sep: ";") do |csv| - csv.add_row [1, 2, 3] - csv << [4, 5, 6] + it "accepts a col separator" do + csv_str = CSV.generate(col_sep: ";") do |csv| + csv.add_row [1, 2, 3] + csv << [4, 5, 6] + end + csv_str.should == "1;2;3\n4;5;6\n" end - csv_str.should == "1;2;3\n4;5;6\n" - end - it "appends and returns the argument itself" do - str = "" - csv_str = CSV.generate(str) do |csv| - csv.add_row [1, 2, 3] - csv << [4, 5, 6] + it "appends and returns the argument itself" do + str = "" + csv_str = CSV.generate(str) do |csv| + csv.add_row [1, 2, 3] + csv << [4, 5, 6] + end + csv_str.should equal str + str.should == "1,2,3\n4,5,6\n" end - csv_str.should equal str - str.should == "1,2,3\n4,5,6\n" end end diff --git a/spec/ruby/library/csv/iobuf/close_spec.rb b/spec/ruby/library/csv/iobuf/close_spec.rb index e2fda86080..5711a816ec 100644 --- a/spec/ruby/library/csv/iobuf/close_spec.rb +++ b/spec/ruby/library/csv/iobuf/close_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::IOBuf#close" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::IOBuf#close" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/iobuf/initialize_spec.rb b/spec/ruby/library/csv/iobuf/initialize_spec.rb index f08e82548a..0073bd4481 100644 --- a/spec/ruby/library/csv/iobuf/initialize_spec.rb +++ b/spec/ruby/library/csv/iobuf/initialize_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::IOBuf#initialize" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::IOBuf#initialize" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/iobuf/read_spec.rb b/spec/ruby/library/csv/iobuf/read_spec.rb index b45334ee2a..e74d8178dd 100644 --- a/spec/ruby/library/csv/iobuf/read_spec.rb +++ b/spec/ruby/library/csv/iobuf/read_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::IOBuf#read" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::IOBuf#read" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/iobuf/terminate_spec.rb b/spec/ruby/library/csv/iobuf/terminate_spec.rb index 69289e960c..e4ab00bc4f 100644 --- a/spec/ruby/library/csv/iobuf/terminate_spec.rb +++ b/spec/ruby/library/csv/iobuf/terminate_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::IOBuf#terminate" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::IOBuf#terminate" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/ioreader/close_on_terminate_spec.rb b/spec/ruby/library/csv/ioreader/close_on_terminate_spec.rb index 4887ade1a1..25026091aa 100644 --- a/spec/ruby/library/csv/ioreader/close_on_terminate_spec.rb +++ b/spec/ruby/library/csv/ioreader/close_on_terminate_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::IOReader#close_on_terminate" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::IOReader#close_on_terminate" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/ioreader/get_row_spec.rb b/spec/ruby/library/csv/ioreader/get_row_spec.rb index 5fd2178b1b..c2258738d1 100644 --- a/spec/ruby/library/csv/ioreader/get_row_spec.rb +++ b/spec/ruby/library/csv/ioreader/get_row_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::IOReader#get_row" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::IOReader#get_row" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/ioreader/initialize_spec.rb b/spec/ruby/library/csv/ioreader/initialize_spec.rb index 4e8c0964df..4f3a75cc8e 100644 --- a/spec/ruby/library/csv/ioreader/initialize_spec.rb +++ b/spec/ruby/library/csv/ioreader/initialize_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::IOReader#initialize" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::IOReader#initialize" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/ioreader/terminate_spec.rb b/spec/ruby/library/csv/ioreader/terminate_spec.rb index 676cd03a0f..2403d02a9f 100644 --- a/spec/ruby/library/csv/ioreader/terminate_spec.rb +++ b/spec/ruby/library/csv/ioreader/terminate_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::IOReader#terminate" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::IOReader#terminate" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/liberal_parsing_spec.rb b/spec/ruby/library/csv/liberal_parsing_spec.rb index 9878658027..d344229d5b 100644 --- a/spec/ruby/library/csv/liberal_parsing_spec.rb +++ b/spec/ruby/library/csv/liberal_parsing_spec.rb @@ -1,19 +1,22 @@ require_relative '../../spec_helper' -require 'csv' -describe "CSV#liberal_parsing?" do - it "returns true if illegal input is handled" do - csv = CSV.new("", liberal_parsing: true) - csv.should.liberal_parsing? - end +ruby_version_is ""..."3.4" do + require 'csv' - it "returns false if illegal input is not handled" do - csv = CSV.new("", liberal_parsing: false) - csv.should_not.liberal_parsing? - end + describe "CSV#liberal_parsing?" do + it "returns true if illegal input is handled" do + csv = CSV.new("", liberal_parsing: true) + csv.should.liberal_parsing? + end - it "returns false by default" do - csv = CSV.new("") - csv.should_not.liberal_parsing? + it "returns false if illegal input is not handled" do + csv = CSV.new("", liberal_parsing: false) + csv.should_not.liberal_parsing? + end + + it "returns false by default" do + csv = CSV.new("") + csv.should_not.liberal_parsing? + end end end diff --git a/spec/ruby/library/csv/open_spec.rb b/spec/ruby/library/csv/open_spec.rb index 2d310cda3e..4b5f934e52 100644 --- a/spec/ruby/library/csv/open_spec.rb +++ b/spec/ruby/library/csv/open_spec.rb @@ -1,6 +1,9 @@ require_relative '../../spec_helper' -require 'csv' -describe "CSV.open" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV.open" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/parse_spec.rb b/spec/ruby/library/csv/parse_spec.rb index ef5d4ea3ca..921ee0648d 100644 --- a/spec/ruby/library/csv/parse_spec.rb +++ b/spec/ruby/library/csv/parse_spec.rb @@ -1,93 +1,96 @@ require_relative '../../spec_helper' -require 'csv' -describe "CSV.parse" do +ruby_version_is ""..."3.4" do + require 'csv' - it "parses '' into []" do - result = CSV.parse '' - result.should be_kind_of(Array) - result.should == [] - end + describe "CSV.parse" do - it "parses '\n' into [[]]" do - result = CSV.parse "\n" - result.should == [[]] - end + it "parses '' into []" do + result = CSV.parse '' + result.should be_kind_of(Array) + result.should == [] + end - it "parses 'foo' into [['foo']]" do - result = CSV.parse 'foo' - result.should == [['foo']] - end + it "parses '\n' into [[]]" do + result = CSV.parse "\n" + result.should == [[]] + end - it "parses 'foo,bar,baz' into [['foo','bar','baz']]" do - result = CSV.parse 'foo,bar,baz' - result.should == [['foo','bar','baz']] - end + it "parses 'foo' into [['foo']]" do + result = CSV.parse 'foo' + result.should == [['foo']] + end - it "parses 'foo,baz' into [[foo,nil,baz]]" do - result = CSV.parse 'foo,,baz' - result.should == [['foo',nil,'baz']] - end + it "parses 'foo,bar,baz' into [['foo','bar','baz']]" do + result = CSV.parse 'foo,bar,baz' + result.should == [['foo','bar','baz']] + end - it "parses '\nfoo' into [[],['foo']]" do - result = CSV.parse "\nfoo" - result.should == [[],['foo']] - end + it "parses 'foo,baz' into [[foo,nil,baz]]" do + result = CSV.parse 'foo,,baz' + result.should == [['foo',nil,'baz']] + end - it "parses 'foo\n' into [['foo']]" do - result = CSV.parse "foo\n" - result.should == [['foo']] - end + it "parses '\nfoo' into [[],['foo']]" do + result = CSV.parse "\nfoo" + result.should == [[],['foo']] + end - it "parses 'foo\nbar' into [['foo'],['bar']]" do - result = CSV.parse "foo\nbar" - result.should == [['foo'],['bar']] - end + it "parses 'foo\n' into [['foo']]" do + result = CSV.parse "foo\n" + result.should == [['foo']] + end - it "parses 'foo,bar\nbaz,quz' into [['foo','bar'],['baz','quz']]" do - result = CSV.parse "foo,bar\nbaz,quz" - result.should == [['foo','bar'],['baz','quz']] - end + it "parses 'foo\nbar' into [['foo'],['bar']]" do + result = CSV.parse "foo\nbar" + result.should == [['foo'],['bar']] + end - it "parses 'foo,bar'\nbaz' into [['foo','bar'],['baz']]" do - result = CSV.parse "foo,bar\nbaz" - result.should == [['foo','bar'],['baz']] - end + it "parses 'foo,bar\nbaz,quz' into [['foo','bar'],['baz','quz']]" do + result = CSV.parse "foo,bar\nbaz,quz" + result.should == [['foo','bar'],['baz','quz']] + end - it "parses 'foo\nbar,baz' into [['foo'],['bar','baz']]" do - result = CSV.parse "foo\nbar,baz" - result.should == [['foo'],['bar','baz']] - end + it "parses 'foo,bar'\nbaz' into [['foo','bar'],['baz']]" do + result = CSV.parse "foo,bar\nbaz" + result.should == [['foo','bar'],['baz']] + end - it "parses '\n\nbar' into [[],[],'bar']]" do - result = CSV.parse "\n\nbar" - result.should == [[],[],['bar']] - end + it "parses 'foo\nbar,baz' into [['foo'],['bar','baz']]" do + result = CSV.parse "foo\nbar,baz" + result.should == [['foo'],['bar','baz']] + end - it "parses 'foo' into [['foo']] with a separator of ;" do - result = CSV.parse "foo", col_sep: ?; - result.should == [['foo']] - end + it "parses '\n\nbar' into [[],[],'bar']]" do + result = CSV.parse "\n\nbar" + result.should == [[],[],['bar']] + end - it "parses 'foo;bar' into [['foo','bar']] with a separator of ;" do - result = CSV.parse "foo;bar", col_sep: ?; - result.should == [['foo','bar']] - end + it "parses 'foo' into [['foo']] with a separator of ;" do + result = CSV.parse "foo", col_sep: ?; + result.should == [['foo']] + end - it "parses 'foo;bar\nbaz;quz' into [['foo','bar'],['baz','quz']] with a separator of ;" do - result = CSV.parse "foo;bar\nbaz;quz", col_sep: ?; - result.should == [['foo','bar'],['baz','quz']] - end + it "parses 'foo;bar' into [['foo','bar']] with a separator of ;" do + result = CSV.parse "foo;bar", col_sep: ?; + result.should == [['foo','bar']] + end - it "raises CSV::MalformedCSVError exception if input is illegal" do - -> { - CSV.parse('"quoted" field') - }.should raise_error(CSV::MalformedCSVError) - end + it "parses 'foo;bar\nbaz;quz' into [['foo','bar'],['baz','quz']] with a separator of ;" do + result = CSV.parse "foo;bar\nbaz;quz", col_sep: ?; + result.should == [['foo','bar'],['baz','quz']] + end - it "handles illegal input with the liberal_parsing option" do - illegal_input = '"Johnson, Dwayne",Dwayne "The Rock" Johnson' - result = CSV.parse(illegal_input, liberal_parsing: true) - result.should == [["Johnson, Dwayne", 'Dwayne "The Rock" Johnson']] + it "raises CSV::MalformedCSVError exception if input is illegal" do + -> { + CSV.parse('"quoted" field') + }.should raise_error(CSV::MalformedCSVError) + end + + it "handles illegal input with the liberal_parsing option" do + illegal_input = '"Johnson, Dwayne",Dwayne "The Rock" Johnson' + result = CSV.parse(illegal_input, liberal_parsing: true) + result.should == [["Johnson, Dwayne", 'Dwayne "The Rock" Johnson']] + end end end diff --git a/spec/ruby/library/csv/read_spec.rb b/spec/ruby/library/csv/read_spec.rb index 2e6bb65d56..e455a40f73 100644 --- a/spec/ruby/library/csv/read_spec.rb +++ b/spec/ruby/library/csv/read_spec.rb @@ -1,6 +1,9 @@ require_relative '../../spec_helper' -require 'csv' -describe "CSV.read" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV.read" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/readlines_spec.rb b/spec/ruby/library/csv/readlines_spec.rb index 14dea34381..9ca0859252 100644 --- a/spec/ruby/library/csv/readlines_spec.rb +++ b/spec/ruby/library/csv/readlines_spec.rb @@ -1,35 +1,38 @@ require_relative '../../spec_helper' -require 'csv' -describe "CSV.readlines" do - it "needs to be reviewed for spec completeness" -end +ruby_version_is ""..."3.4" do + require 'csv' -describe "CSV#readlines" do - it "returns an Array of Array containing each element in a one-line CSV file" do - file = CSV.new "a, b, c" - file.readlines.should == [["a", " b", " c"]] + describe "CSV.readlines" do + it "needs to be reviewed for spec completeness" end - it "returns an Array of Arrays containing each element in a multi-line CSV file" do - file = CSV.new "a, b, c\nd, e, f" - file.readlines.should == [["a", " b", " c"], ["d", " e", " f"]] - end + describe "CSV#readlines" do + it "returns an Array of Array containing each element in a one-line CSV file" do + file = CSV.new "a, b, c" + file.readlines.should == [["a", " b", " c"]] + end - it "returns nil for a missing value" do - file = CSV.new "a,, b, c" - file.readlines.should == [["a", nil, " b", " c"]] - end + it "returns an Array of Arrays containing each element in a multi-line CSV file" do + file = CSV.new "a, b, c\nd, e, f" + file.readlines.should == [["a", " b", " c"], ["d", " e", " f"]] + end - it "raises CSV::MalformedCSVError exception if input is illegal" do - csv = CSV.new('"quoted" field') - -> { csv.readlines }.should raise_error(CSV::MalformedCSVError) - end + it "returns nil for a missing value" do + file = CSV.new "a,, b, c" + file.readlines.should == [["a", nil, " b", " c"]] + end - it "handles illegal input with the liberal_parsing option" do - illegal_input = '"Johnson, Dwayne",Dwayne "The Rock" Johnson' - csv = CSV.new(illegal_input, liberal_parsing: true) - result = csv.readlines - result.should == [["Johnson, Dwayne", 'Dwayne "The Rock" Johnson']] + it "raises CSV::MalformedCSVError exception if input is illegal" do + csv = CSV.new('"quoted" field') + -> { csv.readlines }.should raise_error(CSV::MalformedCSVError) + end + + it "handles illegal input with the liberal_parsing option" do + illegal_input = '"Johnson, Dwayne",Dwayne "The Rock" Johnson' + csv = CSV.new(illegal_input, liberal_parsing: true) + result = csv.readlines + result.should == [["Johnson, Dwayne", 'Dwayne "The Rock" Johnson']] + end end end diff --git a/spec/ruby/library/csv/streambuf/add_buf_spec.rb b/spec/ruby/library/csv/streambuf/add_buf_spec.rb index 58c530c500..42a9eb68be 100644 --- a/spec/ruby/library/csv/streambuf/add_buf_spec.rb +++ b/spec/ruby/library/csv/streambuf/add_buf_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::StreamBuf#add_buf" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::StreamBuf#add_buf" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/streambuf/buf_size_spec.rb b/spec/ruby/library/csv/streambuf/buf_size_spec.rb index 1793c8b65e..9a9d34bdef 100644 --- a/spec/ruby/library/csv/streambuf/buf_size_spec.rb +++ b/spec/ruby/library/csv/streambuf/buf_size_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::StreamBuf#buf_size" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::StreamBuf#buf_size" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/streambuf/drop_spec.rb b/spec/ruby/library/csv/streambuf/drop_spec.rb index 448f0a2196..befe0da2f8 100644 --- a/spec/ruby/library/csv/streambuf/drop_spec.rb +++ b/spec/ruby/library/csv/streambuf/drop_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::StreamBuf#drop" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::StreamBuf#drop" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/streambuf/element_reference_spec.rb b/spec/ruby/library/csv/streambuf/element_reference_spec.rb index 5a75901830..5ff42beeee 100644 --- a/spec/ruby/library/csv/streambuf/element_reference_spec.rb +++ b/spec/ruby/library/csv/streambuf/element_reference_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::StreamBuf#[]" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::StreamBuf#[]" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/streambuf/get_spec.rb b/spec/ruby/library/csv/streambuf/get_spec.rb index 2255e55e91..0aa5e72e8f 100644 --- a/spec/ruby/library/csv/streambuf/get_spec.rb +++ b/spec/ruby/library/csv/streambuf/get_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::StreamBuf#get" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::StreamBuf#get" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/streambuf/idx_is_eos_spec.rb b/spec/ruby/library/csv/streambuf/idx_is_eos_spec.rb index 563b8b2d4a..f38cb7d8f8 100644 --- a/spec/ruby/library/csv/streambuf/idx_is_eos_spec.rb +++ b/spec/ruby/library/csv/streambuf/idx_is_eos_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::StreamBuf#idx_is_eos?" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::StreamBuf#idx_is_eos?" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/streambuf/initialize_spec.rb b/spec/ruby/library/csv/streambuf/initialize_spec.rb index 1273c98094..3655b02e25 100644 --- a/spec/ruby/library/csv/streambuf/initialize_spec.rb +++ b/spec/ruby/library/csv/streambuf/initialize_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::StreamBuf#initialize" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::StreamBuf#initialize" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/streambuf/is_eos_spec.rb b/spec/ruby/library/csv/streambuf/is_eos_spec.rb index a0a3c1e0b0..9891536fea 100644 --- a/spec/ruby/library/csv/streambuf/is_eos_spec.rb +++ b/spec/ruby/library/csv/streambuf/is_eos_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::StreamBuf#is_eos?" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::StreamBuf#is_eos?" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/streambuf/read_spec.rb b/spec/ruby/library/csv/streambuf/read_spec.rb index cf98c53409..7a82d0d13d 100644 --- a/spec/ruby/library/csv/streambuf/read_spec.rb +++ b/spec/ruby/library/csv/streambuf/read_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::StreamBuf#read" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::StreamBuf#read" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/streambuf/rel_buf_spec.rb b/spec/ruby/library/csv/streambuf/rel_buf_spec.rb index 548e347200..2994f5c950 100644 --- a/spec/ruby/library/csv/streambuf/rel_buf_spec.rb +++ b/spec/ruby/library/csv/streambuf/rel_buf_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::StreamBuf#rel_buf" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::StreamBuf#rel_buf" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/streambuf/terminate_spec.rb b/spec/ruby/library/csv/streambuf/terminate_spec.rb index 247b33184a..e720d83703 100644 --- a/spec/ruby/library/csv/streambuf/terminate_spec.rb +++ b/spec/ruby/library/csv/streambuf/terminate_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::StreamBuf#terminate" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::StreamBuf#terminate" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/stringreader/get_row_spec.rb b/spec/ruby/library/csv/stringreader/get_row_spec.rb index 5cc3447061..b4a13cf38a 100644 --- a/spec/ruby/library/csv/stringreader/get_row_spec.rb +++ b/spec/ruby/library/csv/stringreader/get_row_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::StringReader#get_row" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::StringReader#get_row" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/stringreader/initialize_spec.rb b/spec/ruby/library/csv/stringreader/initialize_spec.rb index 4e3634847e..2c71d8a8b8 100644 --- a/spec/ruby/library/csv/stringreader/initialize_spec.rb +++ b/spec/ruby/library/csv/stringreader/initialize_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::StringReader#initialize" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::StringReader#initialize" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/writer/add_row_spec.rb b/spec/ruby/library/csv/writer/add_row_spec.rb index 2f074b45db..27af76a637 100644 --- a/spec/ruby/library/csv/writer/add_row_spec.rb +++ b/spec/ruby/library/csv/writer/add_row_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::Writer#add_row" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::Writer#add_row" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/writer/append_spec.rb b/spec/ruby/library/csv/writer/append_spec.rb index 4e1f6728c2..1c968e2b97 100644 --- a/spec/ruby/library/csv/writer/append_spec.rb +++ b/spec/ruby/library/csv/writer/append_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::Writer#<<" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::Writer#<<" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/writer/close_spec.rb b/spec/ruby/library/csv/writer/close_spec.rb index 1a87094bb7..65292dc4d0 100644 --- a/spec/ruby/library/csv/writer/close_spec.rb +++ b/spec/ruby/library/csv/writer/close_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::Writer#close" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::Writer#close" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/writer/create_spec.rb b/spec/ruby/library/csv/writer/create_spec.rb index a4514d5578..0af9f44ff4 100644 --- a/spec/ruby/library/csv/writer/create_spec.rb +++ b/spec/ruby/library/csv/writer/create_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::Writer.create" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::Writer.create" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/writer/generate_spec.rb b/spec/ruby/library/csv/writer/generate_spec.rb index 6ea9161777..8200ae566d 100644 --- a/spec/ruby/library/csv/writer/generate_spec.rb +++ b/spec/ruby/library/csv/writer/generate_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::Writer.generate" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::Writer.generate" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/writer/initialize_spec.rb b/spec/ruby/library/csv/writer/initialize_spec.rb index 6bba8f8d0a..574f39978a 100644 --- a/spec/ruby/library/csv/writer/initialize_spec.rb +++ b/spec/ruby/library/csv/writer/initialize_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::Writer#initialize" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::Writer#initialize" do + it "needs to be reviewed for spec completeness" + end end diff --git a/spec/ruby/library/csv/writer/terminate_spec.rb b/spec/ruby/library/csv/writer/terminate_spec.rb index 77136dd018..56b78e1088 100644 --- a/spec/ruby/library/csv/writer/terminate_spec.rb +++ b/spec/ruby/library/csv/writer/terminate_spec.rb @@ -1,6 +1,9 @@ require_relative '../../../spec_helper' -require 'csv' -describe "CSV::Writer#terminate" do - it "needs to be reviewed for spec completeness" +ruby_version_is ""..."3.4" do + require 'csv' + + describe "CSV::Writer#terminate" do + it "needs to be reviewed for spec completeness" + end end