Skip to content

Commit 8ff8c7e

Browse files
Refactor ParserStructureConcatenationTest to inline parser creation in concat tests.
1 parent 8061259 commit 8ff8c7e

File tree

1 file changed

+52
-52
lines changed

1 file changed

+52
-52
lines changed

core/common/test/format/ParserStructureConcatenationTest.kt

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ class ParserStructureConcatenationTest {
1818

1919
@Test
2020
fun concatDistributesUnconditionalModificationAfterNumberSpanParserOperation() {
21-
val parser = ParserStructure<Int>(
22-
operations = listOf(
23-
UnconditionalModification { }
24-
),
25-
followedBy = listOf(
26-
ParserStructure(
27-
operations = listOf(
28-
NumberSpanParserOperation(listOf(ConstantNumberConsumer("34")))
29-
),
30-
followedBy = listOf()
21+
val actual = listOf(
22+
ParserStructure<Int>(
23+
operations = listOf(
24+
UnconditionalModification { }
25+
),
26+
followedBy = listOf(
27+
ParserStructure(
28+
operations = listOf(
29+
NumberSpanParserOperation(listOf(ConstantNumberConsumer("34")))
30+
),
31+
followedBy = listOf()
32+
)
3133
)
3234
)
33-
)
34-
35-
val actual = listOf(parser).concat()
35+
).concat()
3636

3737
with(actual) {
3838
assertTrue(operations.isEmpty())
@@ -50,26 +50,28 @@ class ParserStructureConcatenationTest {
5050

5151
@Test
5252
fun concatFlattensOperations() {
53-
val parser = ParserStructure<Int>(
54-
operations = listOf(),
55-
followedBy = listOf(
56-
ParserStructure(
57-
operations = listOf(),
58-
followedBy = listOf(
59-
ParserStructure(
60-
operations = listOf(),
61-
followedBy = listOf(
62-
ParserStructure(
63-
operations = listOf(),
64-
followedBy = listOf(
65-
ParserStructure(
66-
operations = listOf(),
67-
followedBy = listOf(
68-
ParserStructure(
69-
operations = listOf(
70-
NumberSpanParserOperation(listOf(ConstantNumberConsumer("34")))
71-
),
72-
followedBy = listOf()
53+
val actual = listOf(
54+
ParserStructure<Int>(
55+
operations = listOf(),
56+
followedBy = listOf(
57+
ParserStructure(
58+
operations = listOf(),
59+
followedBy = listOf(
60+
ParserStructure(
61+
operations = listOf(),
62+
followedBy = listOf(
63+
ParserStructure(
64+
operations = listOf(),
65+
followedBy = listOf(
66+
ParserStructure(
67+
operations = listOf(),
68+
followedBy = listOf(
69+
ParserStructure(
70+
operations = listOf(
71+
NumberSpanParserOperation(listOf(ConstantNumberConsumer("34")))
72+
),
73+
followedBy = listOf()
74+
)
7375
)
7476
)
7577
)
@@ -80,9 +82,7 @@ class ParserStructureConcatenationTest {
8082
)
8183
)
8284
)
83-
)
84-
85-
val actual = listOf(parser).concat()
85+
).concat()
8686

8787
with(actual) {
8888
assertTrue(operations.isEmpty())
@@ -97,25 +97,25 @@ class ParserStructureConcatenationTest {
9797

9898
@Test
9999
fun concatDistributesTopLevelNumberSpanParserOperationIntoBranches() {
100-
val parser = ParserStructure<Int>(
101-
operations = listOf(
102-
NumberSpanParserOperation(listOf(ConstantNumberConsumer("12")))
103-
),
104-
followedBy = listOf(
105-
ParserStructure(
106-
operations = listOf(
107-
NumberSpanParserOperation(listOf(ConstantNumberConsumer("34")))
108-
),
109-
followedBy = listOf()
100+
val actual = listOf(
101+
ParserStructure<Int>(
102+
operations = listOf(
103+
NumberSpanParserOperation(listOf(ConstantNumberConsumer("12")))
110104
),
111-
ParserStructure(
112-
operations = listOf(),
113-
followedBy = listOf()
105+
followedBy = listOf(
106+
ParserStructure(
107+
operations = listOf(
108+
NumberSpanParserOperation(listOf(ConstantNumberConsumer("34")))
109+
),
110+
followedBy = listOf()
111+
),
112+
ParserStructure(
113+
operations = listOf(),
114+
followedBy = listOf()
115+
)
114116
)
115117
)
116-
)
117-
118-
val actual = listOf(parser).concat()
118+
).concat()
119119

120120
with(actual) {
121121
assertTrue(operations.isEmpty())

0 commit comments

Comments
 (0)