From 482e22960391b02e3630ae3af4dce64d16dd63e7 Mon Sep 17 00:00:00 2001 From: Robert Widmann Date: Wed, 20 Sep 2017 16:25:13 -0400 Subject: [PATCH] Add more multi-prefix tests --- Sources/FileCheck/Pattern.swift | 4 +++ Tests/FileCheckTests/DAGSpec.swift | 8 +++++ Tests/FileCheckTests/EmptySpec.swift | 7 +++++ Tests/FileCheckTests/FileCheckSpec.swift | 26 ++++++++++++++++ Tests/FileCheckTests/LabelSpec.swift | 8 +++++ Tests/FileCheckTests/MultiPrefixSpec.swift | 36 ++++++++++++++++++++++ Tests/LinuxMain.swift | 4 +++ 7 files changed, 93 insertions(+) diff --git a/Sources/FileCheck/Pattern.swift b/Sources/FileCheck/Pattern.swift index 963ad20..b1f76c5 100644 --- a/Sources/FileCheck/Pattern.swift +++ b/Sources/FileCheck/Pattern.swift @@ -162,7 +162,11 @@ final class Pattern { patternStr = String(patternStr[patternStr.index(end, offsetBy: 4)...]) // Get the regex name (e.g. "foo"). + #if os(macOS) let nameEnd = matchStr.range(of: ":") + #else + let nameEnd = String(matchStr).range(of: ":") + #endif let name : String if let end = nameEnd?.lowerBound { name = String(matchStr[..