-
Notifications
You must be signed in to change notification settings - Fork 2
/
Style.swift
62 lines (46 loc) · 1.99 KB
/
Style.swift
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
//=----------------------------------------------------------------------------=
// This source file is part of the DiffableTextViews open source project.
//
// Copyright (c) 2022 Oscar Byström Ericsson
// Licensed under Apache License, Version 2.0
//
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=
#if DEBUG
@testable import DiffableTextKitXPattern
import XCTest
//*============================================================================*
// MARK: * Style x Tests
//*============================================================================*
protocol StyleTests: XCTestCase {
//=------------------------------------------------------------------------=
// MARK: State
//=------------------------------------------------------------------------=
var style: PatternTextStyle<String> { get }
//=------------------------------------------------------------------------=
// MARK: Tests
//=------------------------------------------------------------------------=
func testNone()
func testSome()
func testFull()
func testMore()
func testNoneMismatch()
func testSomeMismatch()
}
//=----------------------------------------------------------------------------=
// MARK: + Details
//=----------------------------------------------------------------------------=
extension StyleTests {
//=------------------------------------------------------------------------=
// MARK: Assertions
//=------------------------------------------------------------------------=
func OKFormat___(_ input: String, format: String) {
XCTAssertEqual(style.format(input), format)
}
func OKInterpret(_ input: String, format: String, value: String) {
let testable = style.interpret(input)
XCTAssertEqual(testable.value, value)
XCTAssertEqual(testable.snapshot.characters, format)
}
}
#endif