Skip to content
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

Throw error if debug.yaml not found #153

Merged
merged 3 commits into from Feb 29, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions Sources/swift-test/Error.swift
@@ -0,0 +1,22 @@
/*
This source file is part of the Swift.org open source project

Copyright 2015 - 2016 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception

See http://swift.org/LICENSE.txt for license information
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
*/

enum Error: ErrorType {
case DebugYAMLNotFound
}

extension Error: CustomStringConvertible {
var description: String {
switch self {
case .DebugYAMLNotFound:
return "build the package using `swift build` before running tests"
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there's no newline at the end of this file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

2 changes: 2 additions & 0 deletions Sources/swift-test/main.swift
Expand Up @@ -24,6 +24,8 @@ do {
setenv("SPM_INSTALL_PATH", dir.build, 0)

let yamlPath = Path.join(dir.build, "debug.yaml")
if !yamlPath.exists { throw Error.DebugYAMLNotFound }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guard seems more appropriate to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


try build(YAMLPath: yamlPath, target: "test")
let success = test(dir.build, "debug")
exit(success ? 0 : 1)
Expand Down