Fix formatting of nodes with no children (#1351)

For example, this fixes an issue where an empty module turns into ` \n`.

Closes https://github.com/apple/pkl/issues/1348

---------

Co-authored-by: Jen Basch <jbasch94@gmail.com>
This commit is contained in:
Daniel Chao
2025-12-09 11:03:50 -08:00
committed by GitHub
parent 9d41518553
commit 32e9087da9
2 changed files with 8 additions and 1 deletions

View File

@@ -113,4 +113,11 @@ class FormatterTest {
walkDir(outputDir)
}
@Test
fun `whitespace only`() {
for (src in listOf(";;;", "\n", "\n\n\n", "\t")) {
assertThat(format(src)).isEqualTo("\n")
}
}
}