diff --git a/.circleci/config.yml b/.circleci/config.yml index 8ddf818..3a577cb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,9 +1,22 @@ version: 2 jobs: - build: + macOS_swift_4.1: macos: - xcode: "9.2.0" + xcode: "9.3.0" steps: - checkout - run: swift build - run: swift test + linux_swift_4.1: + docker: + - image: norionomura/swift:41 + steps: + - checkout + - run: swift build + - run: swift test +workflows: + version: 2 + workflow: + jobs: + - macOS_swift_4.1 + - linux_swift_4.1 \ No newline at end of file diff --git a/README.md b/README.md index 4f0a2fb..5b8af97 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Beak 🐦 [![SPM](https://img.shields.io/badge/Swift_PM-compatible-brightgreen.svg?style=for-the-badge)](https://swift.org/package-manager) +![Linux](https://img.shields.io/badge/Platforms-macOS_Linux-blue.svg?style=for-the-badge) [![Git Version](https://img.shields.io/github/release/yonaskolb/Beak.svg?style=for-the-badge)](https://github.com/yonaskolb/Beak/releases) [![Build Status](https://img.shields.io/circleci/project/github/yonaskolb/Beak.svg?style=for-the-badge)](https://circleci.com/gh/yonaskolb/Beak) [![license](https://img.shields.io/github/license/yonaskolb/Beak.svg?style=for-the-badge)](https://github.com/yonaskolb/Beak/blob/master/LICENSE) diff --git a/Sources/BeakCore/SourceKit.swift b/Sources/BeakCore/SourceKit.swift index 8a7ff68..667c5ef 100644 --- a/Sources/BeakCore/SourceKit.swift +++ b/Sources/BeakCore/SourceKit.swift @@ -83,7 +83,7 @@ enum Substring { } func extract(from source: [String: SourceKitRepresentable], contents: String) -> String? { - let substring = range(for: source).flatMap { contents.substringWithByteRange(start: Int($0.offset), length: Int($0.length)) } + let substring = range(for: source).flatMap { contents.substring(start: Int($0.offset), length: Int($0.length)) } return substring?.isEmpty == true ? nil : substring?.trimmingCharacters(in: .whitespacesAndNewlines) } } diff --git a/Tests/BeakTests/XCTestManifests.swift b/Tests/BeakTests/XCTestManifests.swift new file mode 100644 index 0000000..cbd8500 --- /dev/null +++ b/Tests/BeakTests/XCTestManifests.swift @@ -0,0 +1,15 @@ +import XCTest + +extension BeakTests { + static let __allTests = [ + ("testBeak", testBeak), + ] +} + +#if !os(macOS) +public func __allTests() -> [XCTestCaseEntry] { + return [ + testCase(BeakTests.__allTests), + ] +} +#endif diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift new file mode 100644 index 0000000..d158229 --- /dev/null +++ b/Tests/LinuxMain.swift @@ -0,0 +1,8 @@ +import XCTest + +import BeakTests + +var tests = [XCTestCaseEntry]() +tests += BeakTests.__allTests() + +XCTMain(tests)