diff --git a/kotlinpoet/src/test/java/com/squareup/kotlinpoet/FileSpecTest.kt b/kotlinpoet/src/test/java/com/squareup/kotlinpoet/FileSpecTest.kt index 61a69bd36b..ffafc80a61 100644 --- a/kotlinpoet/src/test/java/com/squareup/kotlinpoet/FileSpecTest.kt +++ b/kotlinpoet/src/test/java/com/squareup/kotlinpoet/FileSpecTest.kt @@ -1041,4 +1041,23 @@ class FileSpecTest { |""".trimMargin() ) } + + class WackyKey + class OhNoThisDoesNotCompile + + @OptIn(ExperimentalStdlibApi::class) + @Test fun longCommentWithTypes() { + val someLongParameterizedTypeName = typeNameOf>>>>() + val file = FileSpec.builder("com.squareup.tacos", "Taco") + .addComment("this is a long line with a possibly long type: %T", someLongParameterizedTypeName) + .build() + assertThat(file.toString()).isEqualTo( + """ + |// this is a long line with a possibly long type: List>>> + |package com.squareup.tacos + | + |""".trimMargin() + ) + } + }