forked from SwiftyLab/MetaCodable
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPIs.swift
More file actions
76 lines (70 loc) · 2.57 KB
/
Copy pathAPIs.swift
File metadata and controls
76 lines (70 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/// Dummy swift-testing `Tag` type.
public struct Tag {}
/// Dummy swift-testing `Tag` type.
public struct Issue {
/// Dummy swift-testing `record` method implementation.
///
/// Passes the error message and source location to `XCTFail`.
///
/// - Parameters:
/// - message: The failure message.
/// - sourceLocation: The optional source code location.
/// - fileID: The identifier of file, method invoked from.
/// - filePath: The path to file, method invoked from.
/// - line: The source code line, method invoked from.
/// - column: The source code column, method invoked from.
public static func record(
_ message: Message, sourceLocation: Location? = nil,
fileID: StaticString = #fileID, filePath: StaticString = #filePath,
line: UInt = #line, column: UInt = #column
) {
XCTFail(
message.rawValue, file: sourceLocation?.filePath ?? filePath,
line: sourceLocation?.line ?? line
)
}
/// Dummy swift-testing `Tag` type.
public struct Message: ExpressibleByStringLiteral, RawRepresentable {
/// The actual message.
public var rawValue: String
/// Create from a message literal.
///
/// - Parameter rawValue: The actual message.
public init(stringLiteral rawValue: String) {
self.rawValue = rawValue
}
/// Create from a message value.
///
/// - Parameter rawValue: The actual message.
public init(rawValue: String) {
self.rawValue = rawValue
}
}
/// Dummy swift-testing `Tag` type.
public struct Location {
/// The identifier of file source code belongs to.
let fileID: StaticString
/// The path to file source code belongs to.
let filePath: StaticString
/// The line source code belongs to.
let line: UInt
/// The column source code belongs to.
let column: UInt
/// Create location from provided parameters.
///
/// - Parameters:
/// - fileID: The identifier of file source code belongs to.
/// - filePath: The path to file source code belongs to.
/// - line: The line source code belongs to.
/// - column: The column source code belongs to.
public init(
fileID: StaticString, filePath: StaticString,
line: UInt, column: UInt
) {
self.fileID = fileID
self.filePath = filePath
self.line = line
self.column = column
}
}
}