Skip to content

Commit b9eda3a

Browse files
committed
Use rewind/fast forward emojis to denote selection endpoints in tests. The emoji arrows don't render in Chrome, and these emoji stick out better than a few other options.
1 parent 07278c2 commit b9eda3a

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

Sources/_SwiftFormatTestSupport/MarkedText.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public struct MarkedText {
2121
/// The text with all markers removed.
2222
public let textWithoutMarkers: String
2323

24-
/// If the marked text contains "➡️" and "⬅️", they're used to create a selection
24+
/// If the marked text contains "" and "", they're used to create a selection
2525
public var selection: Selection?
2626

2727
/// Creates a new `MarkedText` value by extracting emoji markers from the given text.
@@ -35,9 +35,9 @@ public struct MarkedText {
3535
text += markedText[lastIndex..<marker.range.lowerBound]
3636
lastIndex = marker.range.upperBound
3737

38-
if marker.name == "➡️" {
38+
if marker.name == "" {
3939
lastRangeStart = text.utf8.count
40-
} else if marker.name == "⬅️" {
40+
} else if marker.name == "" {
4141
ranges.append(Selection.Range(start: lastRangeStart, end: text.utf8.count))
4242
} else {
4343
assert(markers[marker.name] == nil, "Marker names must be unique")
@@ -90,7 +90,7 @@ extension Character {
9090
/// location marker.
9191
fileprivate var isMarkerEmoji: Bool {
9292
switch self {
93-
case "0️⃣", "1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟", "ℹ️", "➡️", "⬅️":
93+
case "0️⃣", "1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟", "ℹ️", "", "":
9494
return true
9595
default: return false
9696
}

Tests/SwiftFormatTests/PrettyPrint/AccessorTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ final class AccessorTests: PrettyPrintTestCase {
8484
func testBasicAccessorsWithSelections() {
8585
let input =
8686
"""
87-
➡️struct MyStruct {
87+
⏩struct MyStruct {
8888
var memberValue: Int
8989
var someValue: Int { get { return memberValue + 2 } set(newValue) { memberValue = newValue } }
90-
}⬅️
90+
}
9191
struct MyStruct {
9292
var memberValue: Int
9393
var someValue: Int { @objc get { return memberValue + 2 } @objc(isEnabled) set(newValue) { memberValue = newValue } }
@@ -102,7 +102,7 @@ final class AccessorTests: PrettyPrintTestCase {
102102
}
103103
set(newValue) {
104104
memberValue = newValue && otherValue
105-
➡️memberValue2 = newValue / 2 && andableValue⬅️
105+
⏩memberValue2 = newValue / 2 && andableValue
106106
}
107107
}
108108
}

Tests/SwiftFormatTests/PrettyPrint/CommentTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -278,24 +278,24 @@ final class CommentTests: PrettyPrintTestCase {
278278
let input =
279279
"""
280280
// Array comment
281-
let a = [➡️4⬅️56, // small comment
281+
let a = [⏩4⏪56, // small comment
282282
789]
283283
284284
// Dictionary comment
285-
let b = ["abc": ➡️456, // small comment
286-
"def": 789]⬅️
285+
let b = ["abc": ⏩456, // small comment
286+
"def": 789]
287287
288288
// Trailing comment
289289
let c = [123, 456 // small comment
290290
]
291291
292-
➡️/* Array comment */
292+
/* Array comment */
293293
let a = [456, /* small comment */
294294
789]
295295
296296
/* Dictionary comment */
297297
let b = ["abc": 456, /* small comment */
298-
"def": 789]⬅️
298+
"def": 789]
299299
"""
300300

301301
let expected =

Tests/SwiftFormatTests/PrettyPrint/Selections.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ final class Selections: PrettyPrintTestCase {
55
func testSelectAll() {
66
let input =
77
"""
8-
➡️func foo() {
8+
⏩func foo() {
99
if let SomeReallyLongVar = Some.More.Stuff(), let a = myfunc() {
1010
// do stuff
1111
}
12-
}⬅️
12+
}
1313
"""
1414

1515
let expected =
@@ -30,7 +30,7 @@ final class Selections: PrettyPrintTestCase {
3030
"""
3131
func foo() {
3232
if let SomeReallyLongVar = Some.More.Stuff(), let a = myfunc() {
33-
➡️// do stuff⬅️
33+
// do stuff
3434
}
3535
}
3636
"""
@@ -53,7 +53,7 @@ final class Selections: PrettyPrintTestCase {
5353
"""
5454
func foo() {
5555
if let SomeReallyLongVar = Some.More.Stuff(), let a = myfunc() {
56-
➡️⬅️// do stuff
56+
⏩⏪// do stuff
5757
}
5858
}
5959
"""
@@ -75,7 +75,7 @@ final class Selections: PrettyPrintTestCase {
7575
let input =
7676
"""
7777
func foo() {
78-
if let SomeReallyLongVar ➡️ = ⬅️Some.More.Stuff(), let a = myfunc() {
78+
if let SomeReallyLongVar = ⏪Some.More.Stuff(), let a = myfunc() {
7979
// do stuff
8080
}
8181
}
@@ -101,7 +101,7 @@ final class Selections: PrettyPrintTestCase {
101101
let input =
102102
"""
103103
func foo() {
104-
➡️if let SomeReallyLongVar = Some.More.Stuff(), let a = myfunc() ⬅️{
104+
⏩if let SomeReallyLongVar = Some.More.Stuff(), let a = myfunc() {
105105
// do stuff
106106
}
107107
}
@@ -124,7 +124,7 @@ final class Selections: PrettyPrintTestCase {
124124
let input =
125125
"""
126126
func foo() {
127-
if let SomeReallyLongVar = ➡️Some.More.Stuff(), let a = myfunc()⬅️ {
127+
if let SomeReallyLongVar = ⏩Some.More.Stuff(), let a = myfunc() {
128128
// do stuff
129129
}
130130
}
@@ -149,8 +149,8 @@ final class Selections: PrettyPrintTestCase {
149149
"""
150150
func foo() {
151151
if let SomeReallyLongVar = Some.More.Stuff(), let a = myfunc() {
152-
➡️// do stuff
153-
// do more stuff⬅️
152+
// do stuff
153+
// do more stuff
154154
var i = 0
155155
}
156156
}
@@ -178,7 +178,7 @@ final class Selections: PrettyPrintTestCase {
178178
if let SomeReallyLongVar = Some.More.Stuff(), let a = myfunc() {
179179
// do stuff
180180
// do more stuff
181-
➡️⬅️var i = 0
181+
⏩⏪var i = 0
182182
}
183183
}
184184
"""
@@ -204,9 +204,9 @@ final class Selections: PrettyPrintTestCase {
204204
"""
205205
func foo() {
206206
if let SomeReallyLongVar = Some.More.Stuff(), let a = myfunc() {
207-
➡️⬅️// do stuff
207+
⏩⏪// do stuff
208208
// do more stuff
209-
➡️⬅️var i = 0
209+
⏩⏪var i = 0
210210
}
211211
}
212212
"""

0 commit comments

Comments
 (0)