summaryrefslogtreecommitdiff
path: root/test/csv
diff options
context:
space:
mode:
authorjeg2 <jeg2@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-25 14:46:08 +0000
committerjeg2 <jeg2@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-25 14:46:08 +0000
commit6e7544f132d2903cf88f7f41208913d940068be8 (patch)
treed792df6c66688255fc3124792efed82f6ce1f735 /test/csv
parentce9d84a9f05c2bc891826aa87cc38faac1a1c5b8 (diff)
* lib/csv.rb: Improved stray quoting error message (patch by Edvard Majakari).
* lib/csv.rb: Remove debugging prints. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/csv')
-rwxr-xr-xtest/csv/test_csv_parsing.rb2
-rwxr-xr-xtest/csv/test_encodings.rb17
2 files changed, 15 insertions, 4 deletions
diff --git a/test/csv/test_csv_parsing.rb b/test/csv/test_csv_parsing.rb
index 55d1bee..319f3f3 100755
--- a/test/csv/test_csv_parsing.rb
+++ b/test/csv/test_csv_parsing.rb
@@ -191,7 +191,7 @@ class TestCSV::Parsing < TestCSV
assert_send([csv.lineno, :<, 4])
end
rescue CSV::MalformedCSVError
- assert_equal("Illegal quoting on line 4.", $!.message)
+ assert_equal("Illegal quoting in line 4.", $!.message)
end
end
diff --git a/test/csv/test_encodings.rb b/test/csv/test_encodings.rb
index 54c34f3..5ff6d33 100755
--- a/test/csv/test_encodings.rb
+++ b/test/csv/test_encodings.rb
@@ -80,15 +80,19 @@ class TestCSV::Encodings < TestCSV
end
def test_read_with_default_encoding
- data = "abc"
+ data = "abc"
default_external = Encoding.default_external
each_encoding do |encoding|
File.open(@temp_csv_path, "wb", encoding: encoding) {|f| f << data}
begin
- Encoding.default_external = encoding
+ no_warnings do
+ Encoding.default_external = encoding
+ end
result = CSV.read(@temp_csv_path)[0][0]
ensure
- Encoding.default_external = default_external
+ no_warnings do
+ Encoding.default_external = default_external
+ end
end
assert_equal(encoding, result.encoding)
end
@@ -325,4 +329,11 @@ class TestCSV::Encodings < TestCSV
yield encoding
end
end
+
+ def no_warnings
+ old_verbose, $VERBOSE = $VERBOSE, nil
+ yield
+ ensure
+ $VERBOSE = old_verbose
+ end
end