Hook up unit tests for Linux-based builds
This commit is contained in:
parent
d3d9fab63f
commit
9a061c28c3
|
@ -11,6 +11,21 @@ import XCTest
|
|||
|
||||
class CSVTests: XCTestCase {
|
||||
|
||||
static let allTests = [
|
||||
("testOneLine", testOneLine),
|
||||
("testTwoLines", testTwoLines),
|
||||
("testLastLineIsEmpty", testLastLineIsEmpty),
|
||||
("testLastLineIsWhiteSpace", testLastLineIsWhiteSpace),
|
||||
("testMiddleLineIsEmpty", testMiddleLineIsEmpty),
|
||||
("testCommaInQuotationMarks", testCommaInQuotationMarks),
|
||||
("testEscapedQuotationMark1", testEscapedQuotationMark1),
|
||||
("testEscapedQuotationMark2", testEscapedQuotationMark2),
|
||||
("testEmptyField", testEmptyField),
|
||||
("testDoubleQuoteBeforeLineBreak", testDoubleQuoteBeforeLineBreak),
|
||||
("testSubscript", testSubscript),
|
||||
("testCSVState1", testCSVState1)
|
||||
]
|
||||
|
||||
func testOneLine() {
|
||||
let csv = "\"abc\",1,2"
|
||||
var i = 0
|
||||
|
|
|
@ -11,6 +11,21 @@ import XCTest
|
|||
|
||||
class LineBreakTests: XCTestCase {
|
||||
|
||||
static let allTests = [
|
||||
("testLF", testLF),
|
||||
("testCRLF", testCRLF),
|
||||
("testLastCR", testLastCR),
|
||||
("testLastCRLF", testLastCRLF),
|
||||
("testLastLF", testLastLF),
|
||||
("testLFInQuotationMarks", testLFInQuotationMarks),
|
||||
("testLineBreakLF", testLineBreakLF),
|
||||
("testLineBreakCR", testLineBreakCR),
|
||||
("testLineBreakCRLF", testLineBreakCRLF),
|
||||
("testLineBreakLFLF", testLineBreakLFLF),
|
||||
("testLineBreakCRCR", testLineBreakCRCR),
|
||||
("testLineBreakCRLFCRLF", testLineBreakCRLFCRLF)
|
||||
]
|
||||
|
||||
func testLF() {
|
||||
let csv = "abab,cdcd,efef\nzxcv,asdf,qwer"
|
||||
let records = parse(csv: csv)
|
||||
|
|
|
@ -11,6 +11,14 @@ import XCTest
|
|||
|
||||
class ReadmeTests: XCTestCase {
|
||||
|
||||
static let allTests = [
|
||||
("testFromCSVString", testFromCSVString),
|
||||
("testFromFilePath", testFromFilePath),
|
||||
("testGettingTheHeaderRow", testGettingTheHeaderRow),
|
||||
("testGetTheFieldValueUsingSubscript", testGetTheFieldValueUsingSubscript),
|
||||
("testProvideTheCharacterEncoding", testProvideTheCharacterEncoding)
|
||||
]
|
||||
|
||||
func testFromCSVString() {
|
||||
for row in try! CSV(string: "1,foo\n2,bar") {
|
||||
print("\(row)")
|
||||
|
|
|
@ -11,6 +11,22 @@ import XCTest
|
|||
|
||||
class TrimFieldsTests: XCTestCase {
|
||||
|
||||
static let allTests = [
|
||||
("testTrimFields1", testTrimFields1),
|
||||
("testTrimFields2", testTrimFields2),
|
||||
("testTrimFields3", testTrimFields3),
|
||||
("testTrimFields4", testTrimFields4),
|
||||
("testTrimFields5", testTrimFields5),
|
||||
("testTrimFields6", testTrimFields6),
|
||||
("testTrimFields7", testTrimFields7),
|
||||
("testTrimFields8", testTrimFields8),
|
||||
("testTrimFields9", testTrimFields9),
|
||||
("testTrimFields10", testTrimFields10),
|
||||
("testTrimFields11", testTrimFields11),
|
||||
("testTrimFields12", testTrimFields12),
|
||||
("testTrimFields13", testTrimFields13),
|
||||
]
|
||||
|
||||
func testTrimFields1() {
|
||||
let csvString = "abc,def,ghi"
|
||||
let csv = try! CSV(string: csvString, trimFields: true)
|
||||
|
|
|
@ -12,6 +12,16 @@ import XCTest
|
|||
|
||||
class UnicodeTests: XCTestCase {
|
||||
|
||||
static let allTests = [
|
||||
("testUTF8WithBOM", testUTF8WithBOM),
|
||||
("testUTF16WithNativeEndianBOM", testUTF16WithNativeEndianBOM),
|
||||
("testUTF16WithBigEndianBOM", testUTF16WithBigEndianBOM),
|
||||
("testUTF16WithLittleEndianBOM", testUTF16WithLittleEndianBOM),
|
||||
("testUTF32WithNativeEndianBOM", testUTF32WithNativeEndianBOM),
|
||||
("testUTF32WithBigEndianBOM", testUTF32WithBigEndianBOM),
|
||||
("testUTF32WithLittleEndianBOM", testUTF32WithLittleEndianBOM)
|
||||
]
|
||||
|
||||
func testUTF8WithBOM() {
|
||||
let csvString = "abab,,cdcd,efef\r\nzxcv,asdf,\"qw\"\"er\","
|
||||
let encoding = String.Encoding.utf8
|
||||
|
|
|
@ -7,8 +7,12 @@
|
|||
//
|
||||
|
||||
import XCTest
|
||||
@testable import CSVTestSuite
|
||||
@testable import CSVTests
|
||||
|
||||
XCTMain([
|
||||
testCase(CSVReaderTests.allTests),
|
||||
testCase(CSVTests.allTests),
|
||||
testCase(LineBreakTests.allTests),
|
||||
testCase(ReadmeTests.allTests),
|
||||
testCase(TrimFieldsTests.allTests),
|
||||
testCase(UnicodeTests.allTests)
|
||||
])
|
||||
|
|
Loading…
Reference in New Issue