Skip to content

Commit 7b799da

Browse files
committed
SnapshotFileTest which captures a parsing bug we are having.
1 parent a5073e7 commit 7b799da

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

jvm/selfie-lib/src/commonTest/kotlin/com/diffplug/selfie/SnapshotFileTest.kt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,32 @@ class SnapshotFileTest {
9191
"""
9292
.trimIndent()
9393
}
94+
95+
@Test
96+
fun escapingBug() {
97+
val file =
98+
SnapshotFile.parse(
99+
SnapshotValueReader.of(
100+
"""
101+
╔═ trialStarted/stripe ═╗
102+
103+
╔═ trialStarted/stripe[«1»{\n "params": {\n "line_items": "line_items=\({quantity=1, price=price_xxxx}\)"\n },\n "apiMode": "V1"\n}] ═╗
104+
{}
105+
╔═ [end of file] ═╗
106+
107+
"""
108+
.trimIndent()))
109+
val keys = file.snapshots.keys.toList()
110+
keys.size shouldBe 1
111+
keys[0] shouldBe "trialStarted/stripe"
112+
val snapshot = file.snapshots.get(keys[0])!!
113+
114+
snapshot.facets.keys.size shouldBe 1
115+
snapshot.facets.keys.first() shouldBe """«1»{
116+
"params": {
117+
"line_items": "line_items=[{quantity=1, price=price_xxxx}]"
118+
},
119+
"apiMode": "V1"
120+
}"""
121+
}
94122
}

0 commit comments

Comments
 (0)