Skip to content

Commit f88b5ac

Browse files
committed
More delimiter guessing tests have been added
1 parent 43cae24 commit f88b5ac

File tree

6 files changed

+22
-3
lines changed

6 files changed

+22
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ VBA CSV interface is the most complete, and open source, CSV/TSV VBA parser libr
77

88
## Advantages
99
* __RFC-4180 specs compliant__.
10-
* __Stable__. Fully Test Driven Developed (TDD) library, ([63/63 test passed](https://github.com/ws-garcia/VBA-CSV-interface/blob/master/testing/tests/results/)), that includes 650+ line of code for testing. See [VBA test library by Tim Hall](https://github.com/ws-garcia/vba-test).
10+
* __Stable__. Fully Test Driven Developed (TDD) library, ([64/64 test passed](https://github.com/ws-garcia/VBA-CSV-interface/blob/master/testing/tests/results/)), that includes 650+ line of code for testing. See [VBA test library by Tim Hall](https://github.com/ws-garcia/vba-test).
1111
* __Fast__. Writes and reads files at the highest speed.
1212
* __Memory-friendly__. CSV/[TSV](https://www.iana.org/assignments/media-types/text/tab-separated-values) files are processed using a custom stream technique, only 0.5MB are in memory at a time.
1313
* __Robust__. Parser and writer accept [Unix-style quotes escape sequences](https://www.loc.gov/preservation/digital/formats/fdd/fdd000323.shtml#notes).

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ VBA CSV interface is the most complete, and open source, CSV/TSV VBA parser libr
1414

1515
## Advantages
1616
* __RFC-4180 specs compliant__.
17-
* __Stable__. Fully Test Driven Developed (TDD) library, ([63/63 test passed](https://github.com/ws-garcia/VBA-CSV-interface/blob/master/testing/tests/results/)), that includes 650+ line of code for testing. See [VBA test library by Tim Hall](https://github.com/ws-garcia/vba-test).
17+
* __Stable__. Fully Test Driven Developed (TDD) library, ([64/64 test passed](https://github.com/ws-garcia/VBA-CSV-interface/blob/master/testing/tests/results/)), that includes 650+ line of code for testing. See [VBA test library by Tim Hall](https://github.com/ws-garcia/vba-test).
1818
* __Fast__. Writes and reads files at the highest speed.
1919
* __Memory-friendly__. CSV/[TSV](https://www.iana.org/assignments/media-types/text/tab-separated-values) files are processed using a custom stream technique, only 0.5MB are in memory at a time.
2020
* __Robust__. Parser and writer accept [Unix-style quotes escape sequences](https://www.loc.gov/preservation/digital/formats/fdd/fdd000323.shtml#notes).

src/Tests/CSVDelimitersGuessingTESTS.bas

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ Function DelimitersGuessingTests(FullFileName As String) As TestSuite
166166
"Expected: (" & "[" & ExpectedResult(0) & "]" & " & " & "[" & ExpectedResult(2) & "]" & ")" & _
167167
"Actual: (" & "[" & ActualResult(0) & "]" & " & " & "[" & ActualResult(2) & "]" & ")"
168168
End With
169+
'@--------------------------------------------------------------------------------
170+
'Undefined field delimiter
171+
With DelimitersGuessingTests.test("Undefined field delimiter")
172+
UndefinedFieldDelimiter
173+
.IsEqual ActualResult, ExpectedResult, _
174+
"Expected: (" & "[" & ExpectedResult(0) & "]" & " & " & "[" & ExpectedResult(2) & "]" & ")" & _
175+
"Actual: (" & "[" & ActualResult(0) & "]" & " & " & "[" & ActualResult(2) & "]" & ")"
176+
End With
169177
Set DelimitersGuessingTests = Nothing
170178
End Function
171179
Sub GetActualAndExpectedResults(FileName As String, _
@@ -267,6 +275,11 @@ Sub JsonDataType_clevercsvIssue37()
267275

268276
GetActualAndExpectedResults "Json data type - [clevercsv issue #37].csv", ",", vbLf, DoubleQuotes
269277
End Sub
278+
Sub UndefinedFieldDelimiter()
279+
Set confObj = New parserConfig
280+
281+
GetActualAndExpectedResults "Undefined field delimiter.csv", ",", vbLf, DoubleQuotes
282+
End Sub
270283
'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
271284
'#
272285

1.11 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"This comma (,) need to be escaped"
2+
This CSV has only one column
3+
We will see if a semicolon (;) break the logic
4+
or a single colon (:) or pipe (|)
5+
Also include a Tab ( ) for testing

testing/tests/results/CSV delimiter guessing test - 09-jul-2021 9-59-10.txt renamed to testing/tests/results/CSV delimiter guessing test - 09-jul-2021 18-27-43.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
+ FEC data - [clevercsv issue #15]
1313
+ Mixed comma and colon - [clevercsv issue #35]
1414
+ Json data type - [clevercsv issue #37]
15-
= PASS (13 of 13 passed) = 9/7/2021 9:59:10 a.�m. =
15+
+ Undefined field delimiter
16+
= PASS (14 of 14 passed) = 9/7/2021 6:27:43 p.�m. =
1617

0 commit comments

Comments
 (0)