-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: extend runner with
--only-failures
option
- Loading branch information
Showing
4 changed files
with
94 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
Sources/FeaturevisorTestRunner/FeaturevisorTestRunner+Print.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import FeaturevisorTypes | ||
import Foundation | ||
|
||
extension FeaturevisorTestRunner { | ||
|
||
enum ResultMark: String { | ||
case success = "✔" | ||
case failure = "✘" | ||
|
||
init(result: Bool) { | ||
self = result ? .success : .failure | ||
} | ||
|
||
var mark: String { | ||
return rawValue | ||
} | ||
} | ||
|
||
func printAssertionResult( | ||
environment: Environment, | ||
index: Int, | ||
feature: String, | ||
assertionResult: Bool, | ||
expectedValueFailures: [VariableKey: (expected: VariableValue, got: VariableValue?)], | ||
description: String, | ||
onlyFailures: Bool | ||
) { | ||
|
||
guard onlyFailures && !assertionResult || !onlyFailures else { | ||
return | ||
} | ||
|
||
print("\nTesting: \(feature).feature.yml") | ||
print(" feature \"\(feature)\"") | ||
|
||
let resultMark = ResultMark(result: assertionResult) | ||
|
||
print(" \(resultMark) Assertion #\(index): \(environment.rawValue) \(description)") | ||
|
||
expectedValueFailures.forEach({ (key, value) in | ||
print(" => variable key: \(key)") | ||
print(" => expected: \(value.expected)") | ||
if let got = value.got { | ||
print(" => received: \(got)") | ||
} | ||
else { | ||
print(" => received: nil") | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters