-
-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for missing @partial-block ref #634
- Loading branch information
Showing
2 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
handlebars/src/test/java/com/github/jknack/handlebars/issues/Issue634.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.github.jknack.handlebars.issues; | ||
|
||
import com.github.jknack.handlebars.HandlebarsException; | ||
import com.github.jknack.handlebars.v4Test; | ||
import static org.junit.Assert.assertTrue; | ||
import static org.junit.Assert.fail; | ||
import org.junit.Test; | ||
|
||
public class Issue634 extends v4Test { | ||
|
||
@Test | ||
public void shouldThrowHandlebarsExceptionWhenPartialBlockIsMissing() throws Exception { | ||
try { | ||
shouldCompileTo("{{> my-partial}}", | ||
$("partials", $("my-partial", "Hello {{> @partial-block}}")), null); | ||
fail("Must throw HandlebarsException"); | ||
} catch (HandlebarsException x) { | ||
assertTrue(x.getMessage().contains("does not provide a @partial-block")); | ||
} | ||
} | ||
|
||
@Test | ||
public void shouldNotThrowHandlebarsException() throws Exception { | ||
shouldCompileTo("{{#> my-partial}}634{{/my-partial}}", | ||
$("partials", $("my-partial", "Hello {{> @partial-block}}")), "Hello 634"); | ||
} | ||
|
||
} |