Skip to content

Commit 39c27ab

Browse files
committed
Make position marker in ActiveRegionTests be ascending
1 parent 26d84ab commit 39c27ab

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

Sources/SwiftIfConfig/SwiftIfConfig.docc/SwiftIfConfig.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The syntax tree and its parser do not reason about the build configuration. Rath
2727
The `SwiftIfConfig` library provides utilities to determine which syntax nodes are part of a particular build configuration. Each utility requires that one provide a specific build configuration (i.e., an instance of a type that conforms to the <doc:BuildConfiguration> protocol), and provides a different view on essentially the same information:
2828

2929
* <doc:ActiveSyntaxVisitor> and <doc:ActiveSyntaxAnyVisitor> are visitor types that only visit the syntax nodes that are included ("active") for a given build configuration, implicitly skipping any nodes within inactive `#if` clauses.
30-
* `SyntaxProtocol/removingInactive(in:)` produces a syntax node that removes all inactive regions (and their corresponding `IfConfigDeclSyntax` nodes) from the given syntax tree, returning a new tree that is free of `#if` conditions.
30+
* `SyntaxProtocol.removingInactive(in:)` produces a syntax node that removes all inactive regions (and their corresponding `IfConfigDeclSyntax` nodes) from the given syntax tree, returning a new tree that is free of `#if` conditions.
3131
* `IfConfigDeclSyntax.activeClause(in:)` determines which of the clauses of an `#if` is active for the given build configuration, returning the active clause.
3232
* `SyntaxProtocol.isActive(in:)` determines whether the given syntax node is active for the given build configuration. The result is one of "active"
3333
(the node is included in the program), "inactive" (the node is not included

Tests/SwiftIfConfigTest/ActiveRegionTests.swift

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,56 +29,56 @@ public class ActiveRegionTests: XCTestCase {
2929
func testActiveRegions() throws {
3030
try assertActiveCode(
3131
"""
32-
4️⃣
32+
1️⃣
3333
#if DEBUG
34-
0️⃣func f()
34+
2️⃣func f()
3535
#elseif ASSERTS
36-
1️⃣func g()
36+
3️⃣func g()
3737
3838
#if compiler(>=8.0)
39-
2️⃣func h()
39+
4️⃣func h()
4040
#else
41-
3️⃣var i
41+
5️⃣var i
4242
#endif
4343
#endif
44-
5️⃣token
44+
6️⃣token
4545
""",
4646
configuration: linuxBuildConfig,
4747
states: [
48-
"0️⃣": .active,
49-
"1️⃣": .inactive,
50-
"2️⃣": .unparsed,
48+
"1️⃣": .active,
49+
"2️⃣": .active,
5150
"3️⃣": .inactive,
52-
"4️⃣": .active,
53-
"5️⃣": .active,
51+
"4️⃣": .unparsed,
52+
"5️⃣": .inactive,
53+
"6️⃣": .active,
5454
]
5555
)
5656
}
5757

5858
func testActiveRegionsInPostfix() throws {
5959
try assertActiveCode(
6060
"""
61-
4️⃣a.b()
61+
1️⃣a.b()
6262
#if DEBUG
63-
0️⃣.c()
63+
2️⃣.c()
6464
#elseif ASSERTS
65-
1️⃣.d()
65+
3️⃣.d()
6666
#if compiler(>=8.0)
67-
2️⃣.e()
67+
4️⃣.e()
6868
#else
69-
3️⃣.f()
69+
5️⃣.f()
7070
#endif
7171
#endif
72-
5️⃣.g()
72+
6️⃣.g()
7373
""",
7474
configuration: linuxBuildConfig,
7575
states: [
76-
"0️⃣": .active,
77-
"1️⃣": .inactive,
78-
"2️⃣": .unparsed,
76+
"1️⃣": .active,
77+
"2️⃣": .active,
7978
"3️⃣": .inactive,
80-
"4️⃣": .active,
81-
"5️⃣": .active,
79+
"4️⃣": .unparsed,
80+
"5️⃣": .inactive,
81+
"6️⃣": .active,
8282
]
8383
)
8484
}

0 commit comments

Comments
 (0)