Skip to content

Commit 88f125d

Browse files
committed
Cleanup.
1 parent e5d6c06 commit 88f125d

File tree

18 files changed

+80
-81
lines changed

18 files changed

+80
-81
lines changed

Sources/DiffableTextStylesXNumber/Scheme+Currency.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,7 @@ import Foundation
112112
// MARK: Adjustments
113113
//*========================================================================*
114114

115-
/// A model for marking currency labels as virtual.
116-
///
117-
/// Characters used in a format's currency symbols are usually disjoint
118-
/// from the characters used in the format's numbers, but sometimes they overlap.
119-
/// This model is used to mark currency symbols as virtual when needed.
120-
///
115+
/// A model for marking currency symbols as virtual when necessary.
121116
@usableFromInline struct Adjustments {
122117

123118
//=--------------------------------------------------------------------=
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//=----------------------------------------------------------------------------=
2+
// This source file is part of the DiffableTextViews open source project.
3+
//
4+
// Copyright (c) 2022 Oscar Byström Ericsson
5+
// Licensed under Apache License, Version 2.0
6+
//
7+
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
8+
//=----------------------------------------------------------------------------=
9+
10+
//*============================================================================*
11+
// MARK: Declaration
12+
//*============================================================================*
13+
14+
final class Box<Value: Equatable>: Equatable {
15+
16+
//=------------------------------------------------------------------------=
17+
// MARK: State
18+
//=------------------------------------------------------------------------=
19+
20+
let value: Value
21+
22+
//=------------------------------------------------------------------------=
23+
// MARK: Initializers
24+
//=------------------------------------------------------------------------=
25+
26+
init(_ value: Value ) { self.value = value }
27+
28+
//=------------------------------------------------------------------------=
29+
// MARK: Utilities
30+
//=------------------------------------------------------------------------=
31+
32+
static func == (lhs: Box, rhs: Box) -> Bool { lhs.value == rhs.value }
33+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//=----------------------------------------------------------------------------=
2+
// This source file is part of the DiffableTextViews open source project.
3+
//
4+
// Copyright (c) 2022 Oscar Byström Ericsson
5+
// Licensed under Apache License, Version 2.0
6+
//
7+
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
8+
//=----------------------------------------------------------------------------=
9+
10+
import Foundation
11+
12+
//=----------------------------------------------------------------------------=
13+
// MARK: Locales
14+
//=----------------------------------------------------------------------------=
15+
16+
let en_US = Locale(identifier: "en_US")
17+
let sv_SE = Locale(identifier: "sv_SE")

Tests/DiffableTextKitTests/Styles/StyleTests+Constant.swift

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,18 @@ import XCTest
1818

1919
final class StyleTestsXConstant: XCTestCase {
2020

21-
//=------------------------------------------------------------------------=
22-
// MARK: State
23-
//=------------------------------------------------------------------------=
24-
25-
let en_US = Locale(identifier: "en_US")
26-
let sv_SE = Locale(identifier: "sv_SE")
27-
2821
//=------------------------------------------------------------------------=
2922
// MARK: Tests
3023
//=------------------------------------------------------------------------=
3124

3225
func test() {
3326
//=--------------------------------------=
34-
// MARK: Setup
27+
// Setup
3528
//=--------------------------------------=
3629
let mock0 = Mock(locale: en_US).constant()
3730
let mock1 = mock0.locale(sv_SE)
3831
//=--------------------------------------=
39-
// MARK: Assert
32+
// Assert
4033
//=--------------------------------------=
4134
XCTAssertEqual(mock0, mock1)
4235
XCTAssertEqual(mock0.style.locale, mock1.style.locale)

Tests/DiffableTextKitTests/Styles/StyleTests+Equals.swift

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,19 @@ import XCTest
1818

1919
final class StyleTestsXEquals: XCTestCase {
2020

21-
//=------------------------------------------------------------------------=
22-
// MARK: State
23-
//=------------------------------------------------------------------------=
24-
25-
let en_US = Locale(identifier: "en_US")
26-
let sv_SE = Locale(identifier: "sv_SE")
27-
2821
//=------------------------------------------------------------------------=
2922
// MARK: Tests
3023
//=------------------------------------------------------------------------=
3124

3225
func test() {
3326
//=--------------------------------------=
34-
// MARK: Setup
27+
// Setup
3528
//=--------------------------------------=
3629
let mock0 = Mock(locale: en_US).equals(0)
3730
let mock1 = Mock(locale: sv_SE).equals(0)
3831
let mock2 = Mock(locale: en_US).equals(1)
3932
//=--------------------------------------=
40-
// MARK: Assert
33+
// Assert
4134
//=--------------------------------------=
4235
XCTAssertEqual( mock0, mock1)
4336
XCTAssertNotEqual(mock0, mock2)

Tests/DiffableTextKitTests/Styles/StyleTests+Mock.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ import XCTest
1717

1818
final class StyleTestsXMock: XCTestCase {
1919

20-
//=------------------------------------------------------------------------=
21-
// MARK: State
22-
//=------------------------------------------------------------------------=
23-
24-
let en_US = Locale(identifier: "en_US")
25-
let sv_SE = Locale(identifier: "sv_SE")
26-
2720
//=------------------------------------------------------------------------=
2821
// MARK: Tests
2922
//=------------------------------------------------------------------------=

Tests/DiffableTextKitTests/Utilities/UtilitiesTests+Cache.swift

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import XCTest
1717
//*============================================================================*
1818

1919
final class UtilitiesTestsXCache: XCTestCase {
20+
typealias Value = Box<String>
2021

2122
//=------------------------------------------------------------------------=
2223
// MARK: Tests
@@ -27,31 +28,6 @@ final class UtilitiesTestsXCache: XCTestCase {
2728
storage.insert(Value("ABC"), as: 123)
2829
XCTAssertEqual(Value("ABC"), storage.access(123))
2930
}
30-
31-
//*========================================================================*
32-
// MARK: Value
33-
//*========================================================================*
34-
35-
final class Value: Equatable {
36-
37-
//=------------------------------------------------------------------------=
38-
// MARK: State
39-
//=------------------------------------------------------------------------=
40-
41-
let content: String
42-
43-
//=------------------------------------------------------------------------=
44-
// MARK: Initializers
45-
//=------------------------------------------------------------------------=
46-
47-
init(_ content: String) { self.content = content }
48-
49-
//=------------------------------------------------------------------------=
50-
// MARK: Utilities
51-
//=------------------------------------------------------------------------=
52-
53-
static func == (lhs: Value, rhs: Value) -> Bool { lhs.content == rhs.content }
54-
}
5531
}
5632

5733
#endif

Tests/DiffableTextStylesXNumberTests/Helpers/HelpersTests+Lexicon.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ final class HelpersTestsXLexicon: XCTestCase {
3939
let positive: Int = +1
4040
let negative: Int = -1
4141
//=--------------------------------------=
42-
// MARK: Lexicons
42+
// Lexicons
4343
//=--------------------------------------=
4444
for scheme in standards {
4545
let style = int(scheme).sign(strategy: .always())
@@ -53,7 +53,7 @@ final class HelpersTestsXLexicon: XCTestCase {
5353
func testDigits() {
5454
let number: Int = 1234567890
5555
//=--------------------------------------=
56-
// MARK: Lexicons
56+
// Lexicons
5757
//=--------------------------------------=
5858
for scheme in standards {
5959
let style = int(scheme).grouping(.never)
@@ -65,7 +65,7 @@ final class HelpersTestsXLexicon: XCTestCase {
6565
func testGroupingSeparators() {
6666
let number: Int = 1234567890
6767
//=--------------------------------------=
68-
// MARK: Lexicons
68+
// Lexicons
6969
//=--------------------------------------=
7070
for scheme in standards {
7171
let style = int(scheme).grouping(.automatic)
@@ -77,7 +77,7 @@ final class HelpersTestsXLexicon: XCTestCase {
7777
func testFractionSeparators() {
7878
let number: Double = 0.123
7979
//=--------------------------------------=
80-
// MARK: Lexicons
80+
// Lexicons
8181
//=--------------------------------------=
8282
for scheme in standards {
8383
let style = double(scheme).decimalSeparator(strategy: .always)

Tests/DiffableTextStylesXNumberTests/Helpers/HelpersTests+Links.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ final class HelpersTestsXLinks: XCTestCase {
3434

3535
func testEachLexiconIsFullyBidirectionallyLinked() {
3636
//=--------------------------------------=
37-
// MARK: Lexicons
37+
// Lexicons
3838
//=--------------------------------------=
3939
for lexicon in standards.lazy.map(\.lexicon) {
4040
XCTAssertEachCaseIsBidirectionallyLinked(lexicon.signs)

Tests/DiffableTextStylesXNumberTests/Miscellaneous/MiscellaneousTests+Currency.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class MiscellaneousTestsXCurrency: XCTestCase {
3131

3232
func testCurrencyLabelsDoNotContainNumbers() throws {
3333
//=--------------------------------------=
34-
// MARK: Locales, Currencies
34+
// Locales, Currencies
3535
//=--------------------------------------=
3636
for locale in locales {
3737
for code in currencyCodes {

0 commit comments

Comments
 (0)