Generate LinuxMain.swift using `swift test --generate-linuxmain`

This commit is contained in:
Yasuhiro Hatta 2019-06-29 21:11:46 +09:00
parent b11cfb960f
commit 0f9d4bfd27
11 changed files with 201 additions and 152 deletions

View File

@ -11,14 +11,6 @@ import XCTest
class BinaryReaderTests: XCTestCase { class BinaryReaderTests: XCTestCase {
static let allTests = [
("testReadUInt8WithSmallBuffer", testReadUInt8WithSmallBuffer),
("testReadUInt16BEWithSmallBuffer", testReadUInt16BEWithSmallBuffer),
("testReadUInt16LEWithSmallBuffer", testReadUInt16LEWithSmallBuffer),
("testReadUInt32BEWithSmallBuffer", testReadUInt32BEWithSmallBuffer),
("testReadUInt32LEWithSmallBuffer", testReadUInt32LEWithSmallBuffer)
]
private func random(_ count: Int) -> [UInt8] { private func random(_ count: Int) -> [UInt8] {
var array = [UInt8]() var array = [UInt8]()
for _ in 0 ..< count { for _ in 0 ..< count {

View File

@ -11,29 +11,6 @@ import XCTest
class CSVReaderTests: XCTestCase { class CSVReaderTests: XCTestCase {
static let allTests = [
("testOneLine", testOneLine),
("testTwoLines", testTwoLines),
("testLastLineIsEmpty", testLastLineIsEmpty),
("testLastLineIsWhiteSpace", testLastLineIsWhiteSpace),
("testMiddleLineIsEmpty", testMiddleLineIsEmpty),
("testCommaInQuotationMarks", testCommaInQuotationMarks),
("testEscapedQuotationMark1", testEscapedQuotationMark1),
("testEscapedQuotationMark2", testEscapedQuotationMark2),
("testEmptyField", testEmptyField),
("testDoubleQuoteBeforeLineBreak1", testDoubleQuoteBeforeLineBreak1),
("testDoubleQuoteBeforeLineBreak2", testDoubleQuoteBeforeLineBreak2),
("testCSVState1", testCSVState1),
("testSubscriptInt", testSubscriptInt),
("testHasHeaderRow1", testHasHeaderRow1),
("testHasHeaderRow2", testHasHeaderRow2),
("testHasHeaderRow3", testHasHeaderRow3),
("testHasHeaderRow4", testHasHeaderRow4),
("testSubscript1", testSubscript1),
("testSubscript2", testSubscript2),
("testToArray", testToArray)
]
func testOneLine() { func testOneLine() {
let csv = "\"abc\",1,2" let csv = "\"abc\",1,2"
var i = 0 var i = 0

View File

@ -62,30 +62,6 @@ extension Equatable where Self: DecodableTest {
class CSVRowDecoderTests: XCTestCase { class CSVRowDecoderTests: XCTestCase {
static let allTests = [
("testNoHeader", testNoHeader),
("testNumberOfFieldsIsSmall", testNumberOfFieldsIsSmall),
("testStringCodingKey", testStringCodingKey),
("testTypeInvalidDateFormat", testTypeInvalidDateFormat),
("testIntCodingKey", testIntCodingKey),
("testIntCodingKeyWhileIgnoringHeaders", testIntCodingKeyWhileIgnoringHeaders),
("testTypeMismatch", testTypeMismatch),
("testUnsupportedDecodableField", testUnsupportedDecodableField),
("testDecodeInteger", testDecodeInteger),
("testDecodeFloat", testDecodeFloat),
("testBoolDecodingStrategy_default", testBoolDecodingStrategy_default),
("testBoolDecodingStrategy_custom", testBoolDecodingStrategy_custom),
("testDateDecodingStrategy_deferredToDate", testDateDecodingStrategy_deferredToDate),
("testDateDecodingStrategy_secondsSince1970", testDateDecodingStrategy_secondsSince1970),
("testDateDecodingStrategy_millisecondsSince1970", testDateDecodingStrategy_millisecondsSince1970),
//("testDateDecodingStrategy_iso8601", testDateDecodingStrategy_iso8601),
("testDateDecodingStrategy_formatted", testDateDecodingStrategy_formatted),
("testDateDecodingStrategy_custom", testDateDecodingStrategy_custom),
("testDataDecodingStrategy_base64", testDataDecodingStrategy_base64),
("testDataDecodingStrategy_custom", testDataDecodingStrategy_custom),
("testFoundationDecoding", testFoundationDecoding),
]
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
fileprivate struct SupportedDecodableExample: Decodable, DecodableTest { fileprivate struct SupportedDecodableExample: Decodable, DecodableTest {

View File

@ -24,23 +24,6 @@ extension OutputStream {
class CSVWriterTests: XCTestCase { class CSVWriterTests: XCTestCase {
static let allTests = [
("testSingleFieldSingleRecord", testSingleFieldSingleRecord),
("testSingleFieldMultipleRecord", testSingleFieldMultipleRecord),
("testMultipleFieldSingleRecord", testMultipleFieldSingleRecord),
("testMultipleFieldMultipleRecord", testMultipleFieldMultipleRecord),
("testQuoted", testQuoted),
("testQuotedNewline", testQuotedNewline),
("testEscapeQuote", testEscapeQuote),
("testEscapeQuoteAutomatically", testEscapeQuoteAutomatically),
("testDelimiter", testDelimiter),
("testNewline", testNewline),
("testUTF16BE", testUTF16BE),
("testUTF16LE", testUTF16LE),
("testUTF32BE", testUTF32BE),
("testUTF32LE", testUTF32LE)
]
let str = "TEST-test-1234-😄😆👨‍👩‍👧‍👦" let str = "TEST-test-1234-😄😆👨‍👩‍👧‍👦"
/// xxxx /// xxxx

View File

@ -11,21 +11,6 @@ import XCTest
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"
let records = parse(csv: csv) let records = parse(csv: csv)

View File

@ -11,16 +11,6 @@ import XCTest
class ReadmeTests: XCTestCase { class ReadmeTests: XCTestCase {
static let allTests = [
("testFromCSVString", testFromCSVString),
("testFromFile", testFromFile),
("testGettingTheHeaderRow", testGettingTheHeaderRow),
("testGetTheFieldValueUsingKey", testGetTheFieldValueUsingKey),
("testProvideTheCharacterEncoding", testProvideTheCharacterEncoding),
("testWriteToMemory", testWriteToMemory),
("testWriteToFile", testWriteToFile)
]
// MARK: - Reading // MARK: - Reading
func testFromCSVString() { func testFromCSVString() {

View File

@ -11,27 +11,6 @@ import XCTest
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),
("testTrimFields14", testTrimFields14),
("testTrimFields15", testTrimFields15),
("testTrimFields16", testTrimFields16),
("testTrimFields17", testTrimFields17),
("testTrimFields18", testTrimFields18)
]
func testTrimFields1() { func testTrimFields1() {
let csvString = "abc,def,ghi" let csvString = "abc,def,ghi"
let csv = try! CSVReader(string: csvString, trimFields: true) let csv = try! CSVReader(string: csvString, trimFields: true)

View File

@ -12,16 +12,6 @@ import XCTest
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\","
let encoding = String.Encoding.utf8 let encoding = String.Encoding.utf8

View File

@ -13,10 +13,6 @@ import CSV
class Version1Tests: XCTestCase { class Version1Tests: XCTestCase {
static let allTests = [
("testV1", testV1)
]
func testV1() { func testV1() {
let str = "a,b,c\n1,2,3" let str = "a,b,c\n1,2,3"
let data8 = str.data(using: .utf8)! let data8 = str.data(using: .utf8)!

View File

@ -0,0 +1,195 @@
#if !canImport(ObjectiveC)
import XCTest
extension BinaryReaderTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__BinaryReaderTests = [
("testReadUInt16BEWithSmallBuffer", testReadUInt16BEWithSmallBuffer),
("testReadUInt16LEWithSmallBuffer", testReadUInt16LEWithSmallBuffer),
("testReadUInt32BEWithSmallBuffer", testReadUInt32BEWithSmallBuffer),
("testReadUInt32LEWithSmallBuffer", testReadUInt32LEWithSmallBuffer),
("testReadUInt8WithSmallBuffer", testReadUInt8WithSmallBuffer),
]
}
extension CSVReaderTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__CSVReaderTests = [
("testCommaInQuotationMarks", testCommaInQuotationMarks),
("testCSVState1", testCSVState1),
("testDoubleQuoteBeforeLineBreak1", testDoubleQuoteBeforeLineBreak1),
("testDoubleQuoteBeforeLineBreak2", testDoubleQuoteBeforeLineBreak2),
("testEmptyField", testEmptyField),
("testEscapedQuotationMark1", testEscapedQuotationMark1),
("testEscapedQuotationMark2", testEscapedQuotationMark2),
("testHasHeaderRow1", testHasHeaderRow1),
("testHasHeaderRow2", testHasHeaderRow2),
("testHasHeaderRow3", testHasHeaderRow3),
("testHasHeaderRow4", testHasHeaderRow4),
("testLastLineIsEmpty", testLastLineIsEmpty),
("testLastLineIsWhiteSpace", testLastLineIsWhiteSpace),
("testMiddleLineIsEmpty", testMiddleLineIsEmpty),
("testOneLine", testOneLine),
("testSubscript1", testSubscript1),
("testSubscript2", testSubscript2),
("testSubscriptInt", testSubscriptInt),
("testToArray", testToArray),
("testTwoLines", testTwoLines),
]
}
extension CSVRowDecoderTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__CSVRowDecoderTests = [
("testBoolDecodingStrategy_custom", testBoolDecodingStrategy_custom),
("testBoolDecodingStrategy_default", testBoolDecodingStrategy_default),
("testDataDecodingStrategy_base64", testDataDecodingStrategy_base64),
("testDataDecodingStrategy_custom", testDataDecodingStrategy_custom),
("testDateDecodingStrategy_custom", testDateDecodingStrategy_custom),
("testDateDecodingStrategy_deferredToDate", testDateDecodingStrategy_deferredToDate),
("testDateDecodingStrategy_formatted", testDateDecodingStrategy_formatted),
("testDateDecodingStrategy_iso8601", testDateDecodingStrategy_iso8601),
("testDateDecodingStrategy_millisecondsSince1970", testDateDecodingStrategy_millisecondsSince1970),
("testDateDecodingStrategy_secondsSince1970", testDateDecodingStrategy_secondsSince1970),
("testDecodeFloat", testDecodeFloat),
("testDecodeInteger", testDecodeInteger),
("testFoundationDecoding", testFoundationDecoding),
("testIntCodingKey", testIntCodingKey),
("testIntCodingKeyWhileIgnoringHeaders", testIntCodingKeyWhileIgnoringHeaders),
("testNoHeader", testNoHeader),
("testNumberOfFieldsIsSmall", testNumberOfFieldsIsSmall),
("testStringCodingKey", testStringCodingKey),
("testTypeInvalidDateFormat", testTypeInvalidDateFormat),
("testTypeMismatch", testTypeMismatch),
("testUnsupportedDecodableField", testUnsupportedDecodableField),
]
}
extension CSVWriterTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__CSVWriterTests = [
("testDelimiter", testDelimiter),
("testEscapeQuote", testEscapeQuote),
("testEscapeQuoteAutomatically", testEscapeQuoteAutomatically),
("testMultipleFieldMultipleRecord", testMultipleFieldMultipleRecord),
("testMultipleFieldSingleRecord", testMultipleFieldSingleRecord),
("testNewline", testNewline),
("testQuoted", testQuoted),
("testQuotedNewline", testQuotedNewline),
("testSingleFieldMultipleRecord", testSingleFieldMultipleRecord),
("testSingleFieldSingleRecord", testSingleFieldSingleRecord),
("testUTF16BE", testUTF16BE),
("testUTF16LE", testUTF16LE),
("testUTF32BE", testUTF32BE),
("testUTF32LE", testUTF32LE),
("testValueContainsComma", testValueContainsComma),
]
}
extension LineBreakTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__LineBreakTests = [
("testCRLF", testCRLF),
("testLastCR", testLastCR),
("testLastCRLF", testLastCRLF),
("testLastLF", testLastLF),
("testLF", testLF),
("testLFInQuotationMarks", testLFInQuotationMarks),
("testLineBreakCR", testLineBreakCR),
("testLineBreakCRCR", testLineBreakCRCR),
("testLineBreakCRLF", testLineBreakCRLF),
("testLineBreakCRLFCRLF", testLineBreakCRLFCRLF),
("testLineBreakLF", testLineBreakLF),
("testLineBreakLFLF", testLineBreakLFLF),
]
}
extension ReadmeTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__ReadmeTests = [
("testFromCSVString", testFromCSVString),
("testFromFile", testFromFile),
("testGetTheFieldValueUsingKey", testGetTheFieldValueUsingKey),
("testGettingTheHeaderRow", testGettingTheHeaderRow),
("testProvideTheCharacterEncoding", testProvideTheCharacterEncoding),
("testWriteToFile", testWriteToFile),
("testWriteToMemory", testWriteToMemory),
]
}
extension TrimFieldsTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__TrimFieldsTests = [
("testTrimFields1", testTrimFields1),
("testTrimFields10", testTrimFields10),
("testTrimFields11", testTrimFields11),
("testTrimFields12", testTrimFields12),
("testTrimFields13", testTrimFields13),
("testTrimFields14", testTrimFields14),
("testTrimFields15", testTrimFields15),
("testTrimFields16", testTrimFields16),
("testTrimFields17", testTrimFields17),
("testTrimFields18", testTrimFields18),
("testTrimFields2", testTrimFields2),
("testTrimFields3", testTrimFields3),
("testTrimFields4", testTrimFields4),
("testTrimFields5", testTrimFields5),
("testTrimFields6", testTrimFields6),
("testTrimFields7", testTrimFields7),
("testTrimFields8", testTrimFields8),
("testTrimFields9", testTrimFields9),
]
}
extension UnicodeTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__UnicodeTests = [
("testUTF16WithBigEndianBOM", testUTF16WithBigEndianBOM),
("testUTF16WithLittleEndianBOM", testUTF16WithLittleEndianBOM),
("testUTF16WithNativeEndianBOM", testUTF16WithNativeEndianBOM),
("testUTF32WithBigEndianBOM", testUTF32WithBigEndianBOM),
("testUTF32WithLittleEndianBOM", testUTF32WithLittleEndianBOM),
("testUTF32WithNativeEndianBOM", testUTF32WithNativeEndianBOM),
("testUTF8WithBOM", testUTF8WithBOM),
]
}
extension Version1Tests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__Version1Tests = [
("testV1", testV1),
]
}
public func __allTests() -> [XCTestCaseEntry] {
return [
testCase(BinaryReaderTests.__allTests__BinaryReaderTests),
testCase(CSVReaderTests.__allTests__CSVReaderTests),
testCase(CSVRowDecoderTests.__allTests__CSVRowDecoderTests),
testCase(CSVWriterTests.__allTests__CSVWriterTests),
testCase(LineBreakTests.__allTests__LineBreakTests),
testCase(ReadmeTests.__allTests__ReadmeTests),
testCase(TrimFieldsTests.__allTests__TrimFieldsTests),
testCase(UnicodeTests.__allTests__UnicodeTests),
testCase(Version1Tests.__allTests__Version1Tests),
]
}
#endif

View File

@ -1,22 +1,8 @@
//
// LinuxMain.swift
// CSV
//
// Created by Yasuhiro Hatta on 2016/06/11.
// Copyright © 2016 yaslab. All rights reserved.
//
import XCTest import XCTest
@testable import CSVTests
XCTMain([ import CSVTests
testCase(BinaryReaderTests.allTests),
testCase(CSVReaderTests.allTests), var tests = [XCTestCaseEntry]()
testCase(CSVRowDecoderTests.allTests), tests += CSVTests.__allTests()
testCase(CSVWriterTests.allTests),
testCase(LineBreakTests.allTests), XCTMain(tests)
testCase(ReadmeTests.allTests),
testCase(TrimFieldsTests.allTests),
testCase(UnicodeTests.allTests),
testCase(Version1Tests.allTests)
])