fastercsv 1.5.3 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +7 -0
- data/lib/faster_csv.rb +1819 -1800
- data/test/tc_csv_parsing.rb +16 -0
- metadata +9 -4
data/test/tc_csv_parsing.rb
CHANGED
@@ -109,6 +109,22 @@ class TestCSVParsing < Test::Unit::TestCase
|
|
109
109
|
assert_equal(Array.new, FasterCSV.parse_line("\n1,2,3\n"))
|
110
110
|
end
|
111
111
|
|
112
|
+
def test_rob_edge_cases
|
113
|
+
[ [%Q{"a\nb"}, ["a\nb"]],
|
114
|
+
[%Q{"\n\n\n"}, ["\n\n\n"]],
|
115
|
+
[%Q{a,"b\n\nc"}, ['a', "b\n\nc"]],
|
116
|
+
[%Q{,"\r\n"}, [nil,"\r\n"]],
|
117
|
+
[%Q{,"\r\n."}, [nil,"\r\n."]],
|
118
|
+
[%Q{"a\na","one newline"}, ["a\na", 'one newline']],
|
119
|
+
[%Q{"a\n\na","two newlines"}, ["a\n\na", 'two newlines']],
|
120
|
+
[%Q{"a\r\na","one CRLF"}, ["a\r\na", 'one CRLF']],
|
121
|
+
[%Q{"a\r\n\r\na","two CRLFs"}, ["a\r\n\r\na", 'two CRLFs']],
|
122
|
+
[%Q{with blank,"start\n\nfinish"\n}, ['with blank', "start\n\nfinish"]],
|
123
|
+
].each do |edge_case|
|
124
|
+
assert_equal(edge_case.last, FasterCSV.parse_line(edge_case.first))
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
112
128
|
def test_non_regex_edge_cases
|
113
129
|
# An early version of the non-regex parser fails this test
|
114
130
|
[["foo,\"foo,bar,baz,foo\",\"foo\"", ["foo", "foo,bar,baz,foo", "foo"]]].each do |edge_case|
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastercsv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 11
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 5
|
8
|
-
-
|
9
|
-
version: 1.5.
|
9
|
+
- 4
|
10
|
+
version: 1.5.4
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- James Edward Gray II
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
+
date: 2011-01-07 00:00:00 -06:00
|
18
19
|
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -82,23 +83,27 @@ rdoc_options:
|
|
82
83
|
require_paths:
|
83
84
|
- lib
|
84
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
85
87
|
requirements:
|
86
88
|
- - ">="
|
87
89
|
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
88
91
|
segments:
|
89
92
|
- 0
|
90
93
|
version: "0"
|
91
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
92
96
|
requirements:
|
93
97
|
- - ">="
|
94
98
|
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
95
100
|
segments:
|
96
101
|
- 0
|
97
102
|
version: "0"
|
98
103
|
requirements: []
|
99
104
|
|
100
105
|
rubyforge_project: fastercsv
|
101
|
-
rubygems_version: 1.3.
|
106
|
+
rubygems_version: 1.3.7
|
102
107
|
signing_key:
|
103
108
|
specification_version: 3
|
104
109
|
summary: FasterCSV is CSV, but faster, smaller, and cleaner.
|