Skip to content

Commit

Permalink
#285 line numbers for param with wrong type errors are now correct
Browse files Browse the repository at this point in the history
  • Loading branch information
casid committed Oct 14, 2023
1 parent 302ca59 commit 05f6aee
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void params() {
@Test
void paramWithWrongType() {
Throwable throwable = catchThrowable(() -> templateEngine.render("helloWorld.jte", TemplateUtils.toMap("model", "string"), output));
assertThat(throwable).isInstanceOf(TemplateException.class).hasMessageContaining("Failed to render helloWorld.jte, error at helloWorld.jte:0");
assertThat(throwable).isInstanceOf(TemplateException.class).hasMessageContaining("Failed to render helloWorld.jte, error at helloWorld.jte:1");
}

private void whenTemplateIsRendered(String templateName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class TemplateEngineTest {
@Test
internal fun paramWithWrongType() {
val exception = assertThrows<TemplateException> { templateEngine.render("helloWorld.kte", TemplateUtils.toMap("model", "string"), output) }
assertTrue(exception.message!!.contains("Failed to render helloWorld.kte, error at helloWorld.kte:0"))
assertTrue(exception.message!!.contains("Failed to render helloWorld.kte, error at helloWorld.kte:1"))
}

private fun whenTemplateIsRendered(templateName: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class TemplateEngineTest {
@Test
internal fun paramWithWrongType() {
val exception = assertThrows<TemplateException> { templateEngine.render("helloWorld.kte", TemplateUtils.toMap("model", "string"), output) }
assertTrue(exception.message!!.contains("Failed to render helloWorld.kte, error at helloWorld.kte:0"))
assertTrue(exception.message!!.contains("Failed to render helloWorld.kte, error at helloWorld.kte:1"))
}

private fun whenTemplateIsRendered(templateName: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void params() {
@Test
void paramWithWrongType() {
Throwable throwable = catchThrowable(() -> templateEngine.render("helloWorld.jte", TemplateUtils.toMap("model", "string"), output));
assertThat(throwable).isInstanceOf(TemplateException.class).hasMessageContaining("Failed to render helloWorld.jte, error at helloWorld.jte:0");
assertThat(throwable).isInstanceOf(TemplateException.class).hasMessageContaining("Failed to render helloWorld.jte, error at helloWorld.jte:1");
}

private void whenTemplateIsRendered(String templateName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void params() {
@Test
void paramWithWrongType() {
Throwable throwable = catchThrowable(() -> templateEngine.render("helloWorld.jte", TemplateUtils.toMap("model", "string"), output));
assertThat(throwable).isInstanceOf(TemplateException.class).hasMessageContaining("Failed to render helloWorld.jte, error at helloWorld.jte:0");
assertThat(throwable).isInstanceOf(TemplateException.class).hasMessageContaining("Failed to render helloWorld.jte, error at helloWorld.jte:1");
}

private void whenTemplateIsRendered(String templateName) {
Expand Down

0 comments on commit 05f6aee

Please sign in to comment.