From de1de2b0e8ad04124e8b789f2be59e27d4b8bdc4 Mon Sep 17 00:00:00 2001 From: Kogia-sima Date: Thu, 17 Dec 2020 13:44:27 +0900 Subject: [PATCH] Add continue-break test --- .../templates/continue-break.out | 31 +++++++++++++++++++ .../templates/continue-break.stpl | 9 ++++++ .../integration-tests/tests/template_once.rs | 9 ++++++ 3 files changed, 49 insertions(+) create mode 100644 sailfish-tests/integration-tests/templates/continue-break.out create mode 100644 sailfish-tests/integration-tests/templates/continue-break.stpl diff --git a/sailfish-tests/integration-tests/templates/continue-break.out b/sailfish-tests/integration-tests/templates/continue-break.out new file mode 100644 index 0000000..b86c692 --- /dev/null +++ b/sailfish-tests/integration-tests/templates/continue-break.out @@ -0,0 +1,31 @@ +
+ +
head
+ +
head
+ +
head
+ +
2
+ +
tail
+
head
+ +
3
+ +
tail
+
head
+ +
4
+ +
tail
+
head
+ +
5
+ +
tail
+
head
+ +
6
+ +
diff --git a/sailfish-tests/integration-tests/templates/continue-break.stpl b/sailfish-tests/integration-tests/templates/continue-break.stpl new file mode 100644 index 0000000..db36220 --- /dev/null +++ b/sailfish-tests/integration-tests/templates/continue-break.stpl @@ -0,0 +1,9 @@ +
+<% for i in 0..10 { %> +
head
+ <% if i < 2 { continue; } %> +
<%= i %>
+ <% if i > 5 { break; } %> +
tail
+<% } %> +
diff --git a/sailfish-tests/integration-tests/tests/template_once.rs b/sailfish-tests/integration-tests/tests/template_once.rs index 6a6fb07..35c2ded 100644 --- a/sailfish-tests/integration-tests/tests/template_once.rs +++ b/sailfish-tests/integration-tests/tests/template_once.rs @@ -103,6 +103,15 @@ fn test_include() { ); } +#[derive(TemplateOnce)] +#[template(path = "continue-break.stpl", rm_whitespace = true)] +struct ContinueBreak; + +#[test] +fn continue_break() { + assert_render("continue-break", ContinueBreak); +} + #[derive(TemplateOnce)] #[template(path = "big-table.stpl", rm_whitespace = true)] struct BigTable {