diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..280866b --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.xml text eol=lf diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 77b83a0..b30bfc3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,3 +33,18 @@ jobs: run: | eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" swift test + + windows-test: + name: Windows Test + runs-on: windows-latest + + steps: + - name: Install Swift + uses: compnerd/gha-setup-swift@main + with: + branch: swift-5.8-release + tag: 5.8-RELEASE + - name: Checkout + uses: actions/checkout@master + - name: Build and test + run: swift test diff --git a/Source/FullXMLParser.swift b/Source/FullXMLParser.swift index 99cfaf7..ed91ce4 100644 --- a/Source/FullXMLParser.swift +++ b/Source/FullXMLParser.swift @@ -25,7 +25,7 @@ import Foundation -#if os(Linux) +#if os(Linux) || os(Windows) import FoundationXML #endif diff --git a/Source/LazyXMLParser.swift b/Source/LazyXMLParser.swift index c074f43..dd9d2ff 100644 --- a/Source/LazyXMLParser.swift +++ b/Source/LazyXMLParser.swift @@ -25,7 +25,7 @@ import Foundation -#if os(Linux) +#if os(Linux) || os(Windows) import FoundationXML #endif diff --git a/Tests/SWXMLHashTests/LazyWhiteSpaceParsingTests.swift b/Tests/SWXMLHashTests/LazyWhiteSpaceParsingTests.swift index 6122a19..b430d06 100644 --- a/Tests/SWXMLHashTests/LazyWhiteSpaceParsingTests.swift +++ b/Tests/SWXMLHashTests/LazyWhiteSpaceParsingTests.swift @@ -37,7 +37,7 @@ class LazyWhiteSpaceParsingTests: XCTestCase { // Put setup code here. This method is called before the invocation of each test method in the class. #if SWIFT_PACKAGE - let path = NSString.path(withComponents: NSString(string: #file).pathComponents.dropLast() + ["test.xml"]) + let path = URL(fileURLWithPath: #file).deletingLastPathComponent().appendingPathComponent("test.xml").path #else let bundle = Bundle(for: WhiteSpaceParsingTests.self) let path = bundle.path(forResource: "test", ofType: "xml")! diff --git a/Tests/SWXMLHashTests/WhiteSpaceParsingTests.swift b/Tests/SWXMLHashTests/WhiteSpaceParsingTests.swift index efa1b29..37ed24a 100644 --- a/Tests/SWXMLHashTests/WhiteSpaceParsingTests.swift +++ b/Tests/SWXMLHashTests/WhiteSpaceParsingTests.swift @@ -36,7 +36,7 @@ class WhiteSpaceParsingTests: XCTestCase { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. #if SWIFT_PACKAGE - let path = NSString.path(withComponents: NSString(string: #file).pathComponents.dropLast() + ["test.xml"]) + let path = URL(fileURLWithPath: #file).deletingLastPathComponent().appendingPathComponent("test.xml").path #else let bundle = Bundle(for: WhiteSpaceParsingTests.self) let path = bundle.path(forResource: "test", ofType: "xml")! diff --git a/Tests/SWXMLHashTests/XMLParsingTests.swift b/Tests/SWXMLHashTests/XMLParsingTests.swift index ff7b29c..0a16172 100644 --- a/Tests/SWXMLHashTests/XMLParsingTests.swift +++ b/Tests/SWXMLHashTests/XMLParsingTests.swift @@ -373,7 +373,7 @@ class XMLParsingTests: XCTestCase { XCTAssertNotNil(err) -#if !os(Linux) +#if !(os(Linux) || os(Windows)) if err != nil { XCTAssert(err!.line == 1) }