diff --git a/.travis.yml b/.travis.yml index d62fb96..f836273 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ matrix: include: - os: osx language: objective-c - osx_image: xcode10 + osx_image: xcode10.2 script: - swift test - os: linux @@ -15,9 +15,9 @@ matrix: env: before_install: - wget -q -O - https://swift.org/keys/all-keys.asc | gpg --import - - - wget https://swift.org/builds/swift-4.2-release/ubuntu1404/swift-4.2-RELEASE/swift-4.2-RELEASE-ubuntu14.04.tar.gz - - tar xzf swift-4.2-RELEASE-ubuntu14.04.tar.gz - - export PATH=${PWD}/swift-4.2-RELEASE-ubuntu14.04/usr/bin:"${PATH}" + - wget https://swift.org/builds/swift-5.0-release/ubuntu1404/swift-5.0-RELEASE/swift-5.0-RELEASE-ubuntu14.04.tar.gz + - tar xzf swift-5.0-RELEASE-ubuntu14.04.tar.gz + - export PATH=${PWD}/swift-5.0-RELEASE-ubuntu14.04/usr/bin:"${PATH}" script: - swift test notifications: diff --git a/Package.swift b/Package.swift index 7271bc1..5875de6 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:4.2 +// swift-tools-version:5.0 import PackageDescription diff --git a/Sources/FileCheck/FileCheck.swift b/Sources/FileCheck/FileCheck.swift index f8ce16c..18ff40c 100644 --- a/Sources/FileCheck/FileCheck.swift +++ b/Sources/FileCheck/FileCheck.swift @@ -442,15 +442,15 @@ private func readCheckStrings(in buf : UnsafeBufferPointer, withPrefixes // Okay, we found the prefix, yay. Remember the rest of the line, but // ignore leading whitespace. if !options.contains(.strictWhitespace) || !options.contains(.matchFullLines) { - guard let idx = buffer.index(where: { c in c != (" " as Character).utf8CodePoint && c != ("\t" as Character).utf8CodePoint }) else { + guard let idx = buffer.firstIndex(where: { c in c != (" " as Character).utf8CodePoint && c != ("\t" as Character).utf8CodePoint }) else { return [] } buffer = buffer.dropFront(idx) } // Scan ahead to the end of line. - let EOL : Int = buffer.index(of: ("\n" as Character).utf8CodePoint) - ?? buffer.index(of: ("\r" as Character).utf8CodePoint) + let EOL : Int = buffer.firstIndex(of: ("\n" as Character).utf8CodePoint) + ?? buffer.firstIndex(of: ("\r" as Character).utf8CodePoint) ?? buffer.count - 1 // Remember the location of the start of the pattern, for diagnostics. diff --git a/Sources/FileCheck/Pattern.swift b/Sources/FileCheck/Pattern.swift index e23cad7..2f038b0 100644 --- a/Sources/FileCheck/Pattern.swift +++ b/Sources/FileCheck/Pattern.swift @@ -447,7 +447,7 @@ func countNewlines(in str : String) -> (count: Int, firstIndex: String.Index?) { // Scan for newline. // If we can't find a newline, bail. - guard let EOL = range.index(of: "\n") ?? range.index(of: "\r") else { + guard let EOL = range.firstIndex(of: "\n") ?? range.firstIndex(of: "\r") else { return (newlineCount, firstNewLine) }