Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ language: swift
env:
global:
- FRAMEWORK_NAME=CoreXLSX
- SCHEME=CoreXLSX

jobs:
include:
Expand Down Expand Up @@ -36,13 +35,13 @@ jobs:
script:
- carthage bootstrap
- >
xcodebuild test -scheme $SCHEME
xcodebuild build -scheme CoreXLSXiOS \
-sdk iphonesimulator -destination "$IOS_DEVICE" | xcpretty
- >
xcodebuild test -scheme $SCHEME
xcodebuild build -scheme CoreXSLXtvOS
-sdk appletvsimulator -destination "$TVOS_DEVICE" | xcpretty
- >
xcodebuild test -enableCodeCoverage YES -scheme $SCHEME
xcodebuild test -enableCodeCoverage YES -scheme CoreXLSX
-sdk macosx | xcpretty
- <<: *test
osx_image: xcode10.1
Expand All @@ -59,13 +58,13 @@ jobs:
- TESTS_PATH=$PWD/Tests/CoreXLSXTests swift test
- carthage bootstrap
- >
xcodebuild test -scheme $SCHEME
xcodebuild build -scheme CoreXLSXiOS
-sdk iphonesimulator -destination "$IOS_DEVICE" | xcpretty
- >
xcodebuild test -scheme $SCHEME
xcodebuild build -scheme CoreXSLXtvOS
-sdk appletvsimulator -destination "$TVOS_DEVICE" | xcpretty
- >
xcodebuild test -enableCodeCoverage YES -scheme $SCHEME
xcodebuild test -enableCodeCoverage YES -scheme CoreXLSX
-sdk macosx | xcpretty
after_success:
- bash <(curl -s https://codecov.io/bash)
Expand Down
3 changes: 3 additions & 0 deletions Tests/CoreXLSXTests/CoreXLSX.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ final class CoreXLSXTests: XCTestCase {
let rowsRange: ClosedRange<UInt> = 3...10
let cellsInRange = ws.cells(atColumns: closedRange2, rows: rowsRange)
XCTAssertEqual(cellsInRange.count, closedRange2.count * rowsRange.count)

let strings = try file.parseSharedStrings()
XCTAssertEqual(strings.items.count, 18)
}

func testLegacyPublicAPI() throws {
Expand Down
22 changes: 22 additions & 0 deletions Tests/CoreXLSXTests/SharedStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ private let parsed = SharedStrings(uniqueCount: 18, items: [
private let columnC = ["Name", "Andy", "Andy", "Andy", "Andy", "Andy",
"Chloe", "Chloe", "Chloe", "Chloe", "Chloe"]

private let spacePreserveXML =
"""
<sst uniqueCount="1">
<si>
<r>
<rPr>
<sz val="10"/>
<color indexed="8"/>
<rFont val="Helvetica Neue"/>
</rPr>
<t xml:space="preserve"> the </t>
</r>
</si>
</sst>
""".data(using: .utf8)!

final class SharedStringsTests: XCTestCase {
func testSharedStrings() throws {
guard let file =
Expand Down Expand Up @@ -76,6 +92,12 @@ final class SharedStringsTests: XCTestCase {
XCTAssertEqual(columnC, columnCStrings)
}

func testSpacePreserve() throws {
let decoder = XMLDecoder()
let strings = try decoder.decode(SharedStrings.self, from: spacePreserveXML)
XCTAssertEqual(strings.items.count, 1)
}

static let allTests = [
("testSharedStrings", testSharedStrings),
("testSharedStringsOrder", testSharedStringsOrder),
Expand Down