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 {
|
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() {
|
func testOneLine() {
|
||||||
let csv = "\"abc\",1,2"
|
let csv = "\"abc\",1,2"
|
||||||
var i = 0
|
var i = 0
|
||||||
|
|
|
@ -10,6 +10,21 @@ import XCTest
|
||||||
@testable import CSV
|
@testable import CSV
|
||||||
|
|
||||||
class LineBreakTests: XCTestCase {
|
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() {
|
func testLF() {
|
||||||
let csv = "abab,cdcd,efef\nzxcv,asdf,qwer"
|
let csv = "abab,cdcd,efef\nzxcv,asdf,qwer"
|
||||||
|
|
|
@ -11,6 +11,14 @@ import XCTest
|
||||||
|
|
||||||
class ReadmeTests: XCTestCase {
|
class ReadmeTests: XCTestCase {
|
||||||
|
|
||||||
|
static let allTests = [
|
||||||
|
("testFromCSVString", testFromCSVString),
|
||||||
|
("testFromFilePath", testFromFilePath),
|
||||||
|
("testGettingTheHeaderRow", testGettingTheHeaderRow),
|
||||||
|
("testGetTheFieldValueUsingSubscript", testGetTheFieldValueUsingSubscript),
|
||||||
|
("testProvideTheCharacterEncoding", testProvideTheCharacterEncoding)
|
||||||
|
]
|
||||||
|
|
||||||
func testFromCSVString() {
|
func testFromCSVString() {
|
||||||
for row in try! CSV(string: "1,foo\n2,bar") {
|
for row in try! CSV(string: "1,foo\n2,bar") {
|
||||||
print("\(row)")
|
print("\(row)")
|
||||||
|
|
|
@ -10,6 +10,22 @@ import XCTest
|
||||||
@testable import CSV
|
@testable import CSV
|
||||||
|
|
||||||
class TrimFieldsTests: XCTestCase {
|
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() {
|
func testTrimFields1() {
|
||||||
let csvString = "abc,def,ghi"
|
let csvString = "abc,def,ghi"
|
||||||
|
|
|
@ -11,6 +11,16 @@ import XCTest
|
||||||
@testable import CSV
|
@testable import CSV
|
||||||
|
|
||||||
class UnicodeTests: XCTestCase {
|
class UnicodeTests: XCTestCase {
|
||||||
|
|
||||||
|
static let allTests = [
|
||||||
|
("testUTF8WithBOM", testUTF8WithBOM),
|
||||||
|
("testUTF16WithNativeEndianBOM", testUTF16WithNativeEndianBOM),
|
||||||
|
("testUTF16WithBigEndianBOM", testUTF16WithBigEndianBOM),
|
||||||
|
("testUTF16WithLittleEndianBOM", testUTF16WithLittleEndianBOM),
|
||||||
|
("testUTF32WithNativeEndianBOM", testUTF32WithNativeEndianBOM),
|
||||||
|
("testUTF32WithBigEndianBOM", testUTF32WithBigEndianBOM),
|
||||||
|
("testUTF32WithLittleEndianBOM", testUTF32WithLittleEndianBOM)
|
||||||
|
]
|
||||||
|
|
||||||
func testUTF8WithBOM() {
|
func testUTF8WithBOM() {
|
||||||
let csvString = "abab,,cdcd,efef\r\nzxcv,asdf,\"qw\"\"er\","
|
let csvString = "abab,,cdcd,efef\r\nzxcv,asdf,\"qw\"\"er\","
|
||||||
|
|
|
@ -7,8 +7,12 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import XCTest
|
import XCTest
|
||||||
@testable import CSVTestSuite
|
@testable import CSVTests
|
||||||
|
|
||||||
XCTMain([
|
XCTMain([
|
||||||
testCase(CSVReaderTests.allTests),
|
testCase(CSVTests.allTests),
|
||||||
|
testCase(LineBreakTests.allTests),
|
||||||
|
testCase(ReadmeTests.allTests),
|
||||||
|
testCase(TrimFieldsTests.allTests),
|
||||||
|
testCase(UnicodeTests.allTests)
|
||||||
])
|
])
|
||||||
|
|
Loading…
Reference in New Issue