Skip to content

Commit 22dc4dd

Browse files
add test for throw when parsing HTML
See issue #80
1 parent b581e5c commit 22dc4dd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

SwiftCSVTests/CSVTests.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,13 @@ class CSVTests: XCTestCase {
108108
XCTAssertEqual(expected[index], row)
109109
}
110110
}
111+
112+
func testThrowsOnInvalidData() {
113+
do {
114+
_ = try CSV(string: "\n\n<html lang=\"en\">\n \n <meta charset=\"utf-8\"></html>", delimiter: ",", loadColumns: false)
115+
XCTFail("Expected to throw")
116+
} catch {
117+
XCTAssert(error is CSVParseError)
118+
}
119+
}
111120
}

0 commit comments

Comments
 (0)