Skip to content

Commit

Permalink
Use multi-dollar interpolation to remove ${'$'}
Browse files Browse the repository at this point in the history
Fixes #2288
  • Loading branch information
alexvanyo committed Jan 2, 2025
1 parent 421e613 commit 2a9812e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class RunLengthEncodingCellStateSerializerTests {
format = CellStateFormat.FixedFormat.RunLengthEncoding,
),
serializer.deserializeToCellState(
"""
$$"""
|x = 5, y = 5, rule = B3/S23
|obobo2${'$'}obobo2${'$'}obobo!
|obobo2$obobo2$obobo!
""".trimMargin().lineSequence(),
),
)
Expand All @@ -69,10 +69,10 @@ class RunLengthEncodingCellStateSerializerTests {
format = CellStateFormat.FixedFormat.RunLengthEncoding,
),
serializer.deserializeToCellState(
"""
$$"""
|#C This is a comment
|x = 5, y = 5, rule = B3/S23
|obobo2${'$'}obobo2${'$'}obobo!
|obobo2$obobo2$obobo!
""".trimMargin().lineSequence(),
),
)
Expand All @@ -97,10 +97,10 @@ class RunLengthEncodingCellStateSerializerTests {
format = CellStateFormat.FixedFormat.RunLengthEncoding,
),
serializer.deserializeToCellState(
"""
$$"""
|#R -3 7
|x = 5, y = 5, rule = B3/S23
|obobo2${'$'}obobo2${'$'}obobo!
|obobo2$obobo2$obobo!
""".trimMargin().lineSequence(),
),
)
Expand All @@ -125,10 +125,10 @@ class RunLengthEncodingCellStateSerializerTests {
format = CellStateFormat.FixedFormat.RunLengthEncoding,
),
serializer.deserializeToCellState(
"""
$$"""
|#P -3 7
|x = 5, y = 5, rule = B3/S23
|obobo2${'$'}obobo2${'$'}obobo!
|obobo2$obobo2$obobo!
""".trimMargin().lineSequence(),
),
)
Expand All @@ -137,10 +137,10 @@ class RunLengthEncodingCellStateSerializerTests {
@Test
fun basic_serialization_is_correct() {
assertEquals(
"""
$$"""
|#R 0 0
|x = 5, y = 5, rule = B3/S23
|obobo2${'$'}obobo2${'$'}obobo!
|obobo2$obobo2$obobo!
""".trimMargin(),
serializer.serializeToString(
setOf(
Expand All @@ -161,11 +161,11 @@ class RunLengthEncodingCellStateSerializerTests {
@Test
fun gosper_glider_gun_serialization_is_correct() {
assertEquals(
"""
$$"""
|#R 0 0
|x = 36, y = 9, rule = B3/S23
|24bo${'$'}22bobo${'$'}12b2o6b2o12b2o${'$'}11bo3bo4b2o12b2o${'$'}2o8bo5bo3b2o${'$'}2o8bo3bob2o4b
|obo${'$'}10bo5bo7bo${'$'}11bo3bo${'$'}12b2o!
|24bo$22bobo$12b2o6b2o12b2o$11bo3bo4b2o12b2o$2o8bo5bo3b2o$2o8bo3bob2o4b
|obo$10bo5bo7bo$11bo3bo$12b2o!
""".trimMargin(),
serializer.serializeToString(
"""
Expand All @@ -186,17 +186,17 @@ class RunLengthEncodingCellStateSerializerTests {
@Test
fun slow_puffer_serialization_is_correct() {
assertEquals(
"""
$$"""
|#R 0 0
|x = 82, y = 73, rule = B3/S23
|76b2o${'$'}75b2ob4o${'$'}76b6o${'$'}77b4o${'$'}64b3o${'$'}63b5o${'$'}62b2ob3o${'$'}52b2o9b2o${'$'}51b2ob4o${'$'}52b
|6o${'$'}53b4o3${'$'}44b2o${'$'}43b2ob2o26b2o${'$'}44b4o24bo4bo${'$'}45b2o24bo${'$'}24b6o41bo5bo${'$'}24bo
|5bo40b6o${'$'}24bo${'$'}25bo4bo${'$'}27b2o2${'$'}54b4o${'$'}53b6o${'$'}52b2ob4o${'$'}3bo49b2o${'$'}bo3bo${'$'}o${'$'}o4b
|o${'$'}5o3${'$'}20bo${'$'}b2o10b2obo2bobo${'$'}2ob3o6bobob4obo${'$'}b4o3b3obo${'$'}2b2o8bobob4obo${'$'}
|13b2obo2bobo${'$'}5b2o13bo${'$'}3bo4bo${'$'}2bo${'$'}2bo5bo${'$'}2b6o3${'$'}53b2o${'$'}52b2ob4o${'$'}53b6o${'$'}54b
|4o2${'$'}27b2o${'$'}25bo4bo${'$'}24bo${'$'}24bo5bo40b6o${'$'}24b6o41bo5bo${'$'}45b2o24bo${'$'}44b4o24bo4b
|o${'$'}43b2ob2o26b2o${'$'}44b2o3${'$'}53b4o${'$'}52b6o${'$'}51b2ob4o${'$'}52b2o9b2o${'$'}62b2ob3o${'$'}63b5o${'$'}
|64b3o${'$'}77b4o${'$'}76b6o${'$'}75b2ob4o${'$'}76b2o!
|76b2o$75b2ob4o$76b6o$77b4o$64b3o$63b5o$62b2ob3o$52b2o9b2o$51b2ob4o$52b
|6o$53b4o3$44b2o$43b2ob2o26b2o$44b4o24bo4bo$45b2o24bo$24b6o41bo5bo$24bo
|5bo40b6o$24bo$25bo4bo$27b2o2$54b4o$53b6o$52b2ob4o$3bo49b2o$bo3bo$o$o4b
|o$5o3$20bo$b2o10b2obo2bobo$2ob3o6bobob4obo$b4o3b3obo$2b2o8bobob4obo$
|13b2obo2bobo$5b2o13bo$3bo4bo$2bo$2bo5bo$2b6o3$53b2o$52b2ob4o$53b6o$54b
|4o2$27b2o$25bo4bo$24bo$24bo5bo40b6o$24b6o41bo5bo$45b2o24bo$44b4o24bo4b
|o$43b2ob2o26b2o$44b2o3$53b4o$52b6o$51b2ob4o$52b2o9b2o$62b2ob3o$63b5o$
|64b3o$77b4o$76b6o$75b2ob4o$76b2o!
""".trimMargin(),
serializer.serializeToString(
"""
Expand Down Expand Up @@ -361,19 +361,19 @@ class RunLengthEncodingCellStateSerializerTests {
format = CellStateFormat.FixedFormat.RunLengthEncoding,
),
serializer.deserializeToCellState(
"""
$$"""
|#R 0 0
|x = 82, y = 73, rule = 23/3
|76b2o4b${'$'}75b2ob4o${'$'}76b6o${'$'}77b4ob${'$'}64b3o15b${'$'}63b5o14b${'$'}62b2ob3o14b${'$'}52b2o9b2o
|17b${'$'}51b2ob4o24b${'$'}52b6o24b${'$'}53b4o25b3${'$'}44b2o36b${'$'}43b2ob2o26b2o6b${'$'}44b4o24bo
|4bo4b${'$'}45b2o24bo10b${'$'}24b6o41bo5bo4b${'$'}24bo5bo40b6o5b${'$'}24bo57b${'$'}25bo4bo51b${'$'}
|27b2o53b2${'$'}54b4o24b${'$'}53b6o23b${'$'}52b2ob4o23b${'$'}3bo49b2o27b${'$'}bo3bo76b${'$'}o81b${'$'}o4bo
|76b${'$'}5o77b3${'$'}20bo61b${'$'}b2o10b2obo2bobo60b${'$'}2ob3o6bobob4obo60b${'$'}b4o3b3obo69b${'$'}
|2b2o8bobob4obo60b${'$'}13b2obo2bobo60b${'$'}5b2o13bo61b${'$'}3bo4bo73b${'$'}2bo79b${'$'}2bo5bo
|73b${'$'}2b6o74b3${'$'}53b2o27b${'$'}52b2ob4o23b${'$'}53b6o23b${'$'}54b4o24b2${'$'}27b2o53b${'$'}25bo4bo
|51b${'$'}24bo57b${'$'}24bo5bo40b6o5b${'$'}24b6o41bo5bo4b${'$'}45b2o24bo10b${'$'}44b4o24bo4bo4b${'$'}
|43b2ob2o26b2o6b${'$'}44b2o36b3${'$'}53b4o25b${'$'}52b6o24b${'$'}51b2ob4o24b${'$'}52b2o9b2o17b${'$'}
|62b2ob3o14b${'$'}63b5o14b${'$'}64b3o15b${'$'}77b4ob${'$'}76b6o${'$'}75b2ob4o${'$'}76b2o!
|76b2o4b$75b2ob4o$76b6o$77b4ob$64b3o15b$63b5o14b$62b2ob3o14b$52b2o9b2o
|17b$51b2ob4o24b$52b6o24b$53b4o25b3$44b2o36b$43b2ob2o26b2o6b$44b4o24bo
|4bo4b$45b2o24bo10b$24b6o41bo5bo4b$24bo5bo40b6o5b$24bo57b$25bo4bo51b$
|27b2o53b2$54b4o24b$53b6o23b$52b2ob4o23b$3bo49b2o27b$bo3bo76b$o81b$o4bo
|76b$5o77b3$20bo61b$b2o10b2obo2bobo60b$2ob3o6bobob4obo60b$b4o3b3obo69b$
|2b2o8bobob4obo60b$13b2obo2bobo60b$5b2o13bo61b$3bo4bo73b$2bo79b$2bo5bo
|73b$2b6o74b3$53b2o27b$52b2ob4o23b$53b6o23b$54b4o24b2$27b2o53b$25bo4bo
|51b$24bo57b$24bo5bo40b6o5b$24b6o41bo5bo4b$45b2o24bo10b$44b4o24bo4bo4b$
|43b2ob2o26b2o6b$44b2o36b3$53b4o25b$52b6o24b$51b2ob4o24b$52b2o9b2o17b$
|62b2ob3o14b$63b5o14b$64b3o15b$77b4ob$76b6o$75b2ob4o$76b2o!
""".trimMargin().lineSequence(),
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ fun Project.configureKotlin() {
// TODO: Remove when out of beta: https://youtrack.jetbrains.com/issue/KT-61573
enableLanguageFeature("ExpectActualClasses")
enableLanguageFeature("ContextReceivers")
enableLanguageFeature("MultiDollarInterpolation")
optIn("kotlin.uuid.ExperimentalUuidApi")
}
}
Expand Down

0 comments on commit 2a9812e

Please sign in to comment.