Skip to content

Commit 8f1a3ee

Browse files
committed
Merge pull request #153 from aciidb0mb3r/tests_yaml_check
Throw error if `debug.yaml` not found
2 parents e83af8b + 997f2c2 commit 8f1a3ee

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

Sources/swift-test/Error.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
This source file is part of the Swift.org open source project
3+
4+
Copyright 2015 - 2016 Apple Inc. and the Swift project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+
See http://swift.org/LICENSE.txt for license information
8+
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
*/
10+
11+
enum Error: ErrorType {
12+
case DebugYAMLNotFound
13+
}
14+
15+
extension Error: CustomStringConvertible {
16+
var description: String {
17+
switch self {
18+
case .DebugYAMLNotFound:
19+
return "build the package using `swift build` before running tests"
20+
}
21+
}
22+
}

Sources/swift-test/main.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ do {
2424
setenv("SPM_INSTALL_PATH", dir.build, 0)
2525

2626
let yamlPath = Path.join(dir.build, "debug.yaml")
27+
guard yamlPath.exists else { throw Error.DebugYAMLNotFound }
28+
2729
try build(YAMLPath: yamlPath, target: "test")
2830
let success = test(dir.build, "debug")
2931
exit(success ? 0 : 1)

0 commit comments

Comments
 (0)