Skip to content

Update to Swift 5 #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2019
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
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ matrix:
include:
- os: osx
language: objective-c
osx_image: xcode10
osx_image: xcode10.2
script:
- swift test
- os: linux
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:4.2
// swift-tools-version:5.0

import PackageDescription

Expand Down
6 changes: 3 additions & 3 deletions Sources/FileCheck/FileCheck.swift
Original file line number Diff line number Diff line change
Expand Up @@ -442,15 +442,15 @@ private func readCheckStrings(in buf : UnsafeBufferPointer<CChar>, 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.
Expand Down
2 changes: 1 addition & 1 deletion Sources/FileCheck/Pattern.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down