Skip to content

Commit

Permalink
fixup! Reformat the templates for Kotlin model code
Browse files Browse the repository at this point in the history
Adjust the tests for windows line endings
  • Loading branch information
MariusVolkhart committed Jan 24, 2024
1 parent e33fca2 commit 3aa393e
Showing 1 changed file with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public void generatesKotlinWithoutDefaultValueForContentParams() {
}
));
var expected = Map.of(
"Templates.kt", """
"Templates.kt", withSystemLineEndings("""
@file:Suppress("ktlint")
package test.myktemplates
Expand All @@ -242,8 +242,8 @@ interface Templates {
@JteView("hello.kte")
fun hello(content: gg.jte.Content): JteModel
}""",
"StaticTemplates.kt", """
}"""),
"StaticTemplates.kt", withSystemLineEndings("""
@file:Suppress("ktlint")
package test.myktemplates
Expand All @@ -262,8 +262,8 @@ override fun hello(content: gg.jte.Content): JteModel = StaticJteModel<TemplateO
JtehelloGenerated.JTE_LINE_INFO
)
}""",
"DynamicTemplates.kt", """
}"""),
"DynamicTemplates.kt", withSystemLineEndings("""
@file:Suppress("ktlint")
package test.myktemplates
Expand All @@ -282,7 +282,7 @@ override fun hello(content: gg.jte.Content): JteModel {
return DynamicJteModel(engine, "hello.kte", paramMap)
}
}"""
}""")
);
assertThat(actual).containsExactlyInAnyOrderEntriesOf(expected);
}
Expand Down Expand Up @@ -314,7 +314,7 @@ public void generatesKotlinFacadesWithNoParameters() {
}
));
var expected = Map.of(
"Templates.kt", """
"Templates.kt", withSystemLineEndings("""
@file:Suppress("ktlint")
package test.myktemplates
Expand All @@ -325,8 +325,8 @@ interface Templates {
@JteView("hello.kte")
fun hello(): JteModel
}""",
"StaticTemplates.kt", """
}"""),
"StaticTemplates.kt", withSystemLineEndings("""
@file:Suppress("ktlint")
package test.myktemplates
Expand All @@ -345,8 +345,8 @@ override fun hello(): JteModel = StaticJteModel<TemplateOutput>(
JtehelloGenerated.JTE_LINE_INFO
)
}""",
"DynamicTemplates.kt", """
}"""),
"DynamicTemplates.kt", withSystemLineEndings("""
@file:Suppress("ktlint")
package test.myktemplates
Expand All @@ -362,9 +362,13 @@ override fun hello(): JteModel {
return DynamicJteModel(engine, "hello.kte", paramMap)
}
}"""
}""")
);
assertThat(actual).containsExactlyInAnyOrderEntriesOf(expected);
}
}

private static String withSystemLineEndings(String content) {
return content.replaceAll("\n", System.lineSeparator());
}
}

0 comments on commit 3aa393e

Please sign in to comment.