Skip to content

Commit 4087097

Browse files
committed
Test: promote check to library
(cherry picked from commit a74e7ce)
1 parent 81f8721 commit 4087097

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

test/Inputs/Swiftskell.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ public protocol Generator: ~Copyable {
5555
func next() -> Maybe<Element>
5656
}
5757

58+
/// Eager assertion function, to avoid autoclosures.
59+
public func check(_ result: Bool, _ string: String? = nil,
60+
_ file: String = #file, _ line: Int = #line) {
61+
if result { return }
62+
var msg = "assertion failure (\(file):\(line))"
63+
if let extra = string {
64+
msg += ":\t" + extra
65+
}
66+
fatalError(msg)
67+
}
68+
5869
// MARK: Tuples
5970
public enum Pair<L: ~Copyable, R: ~Copyable>: ~Copyable {
6071
case pair(L, R)

test/Interpreter/moveonly_swiftskell.swift

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@
2020

2121
import Swiftskell
2222

23-
/// assertion function
24-
func check(_ result: Bool, _ string: String? = nil, _ line: Int = #line) {
25-
if result { return }
26-
var msg = "assertion failure (line \(line))"
27-
if let extra = string {
28-
msg += ":\t" + extra
29-
}
30-
fatalError(msg)
31-
}
32-
3323
/// Basic noncopyable type for testing.
3424
struct File: ~Copyable, Show {
3525
let id: Int

0 commit comments

Comments
 (0)