You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2017/08/05 14:26:54 UTC
[34/50] incubator-freemarker git commit: Additions to the recent
#switch improvements.
Additions to the recent #switch improvements.
Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/c3672d96
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/c3672d96
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/c3672d96
Branch: refs/heads/2.3
Commit: c3672d96544e1cb96454410cd76a737ec4cf80e5
Parents: 6f0283d
Author: ddekany <dd...@apache.org>
Authored: Sun Jul 9 17:12:52 2017 +0200
Committer: ddekany <dd...@apache.org>
Committed: Sun Jul 9 17:12:52 2017 +0200
----------------------------------------------------------------------
src/main/java/freemarker/core/SwitchBlock.java | 2 +-
.../resources/freemarker/test/templatesuite/expected/switch.txt | 2 ++
.../resources/freemarker/test/templatesuite/templates/switch.ftl | 3 +++
3 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c3672d96/src/main/java/freemarker/core/SwitchBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/SwitchBlock.java b/src/main/java/freemarker/core/SwitchBlock.java
index 15a5eea..3f8a320 100644
--- a/src/main/java/freemarker/core/SwitchBlock.java
+++ b/src/main/java/freemarker/core/SwitchBlock.java
@@ -142,7 +142,7 @@ final class SwitchBlock extends TemplateElement {
// The first #case might have shifted in the child array, so we have to find it again:
int ln = getChildCount();
int i = 0;
- while (i < ln && !(getChildAt(i) instanceof Case)) {
+ while (i < ln && !(getChild(i) instanceof Case)) {
i++;
}
firstCaseIndex = i;
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c3672d96/src/test/resources/freemarker/test/templatesuite/expected/switch.txt
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/test/templatesuite/expected/switch.txt b/src/test/resources/freemarker/test/templatesuite/expected/switch.txt
index 5d42785..d0dbd27 100644
--- a/src/test/resources/freemarker/test/templatesuite/expected/switch.txt
+++ b/src/test/resources/freemarker/test/templatesuite/expected/switch.txt
@@ -63,6 +63,8 @@
[]
+[]
+
""
"1234"
"234"
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c3672d96/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl
----------------------------------------------------------------------
diff --git a/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl b/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl
index 4404307..e9bd377 100644
--- a/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl
+++ b/src/test/resources/freemarker/test/templatesuite/templates/switch.ftl
@@ -97,6 +97,7 @@
<#case 3>
3
<#switch x*2>
+ <#-- Comment is allowed here since 2.3.27 -->
<#case 1>
i1
<#break>
@@ -122,6 +123,8 @@
<#case 1>sadas
</#switch>]
+[<#switch 213></#switch>]
+
<#-- Fall-through -->
<#list [ 0, 1, 2, 3, 4 ] as x>
"<#switch x><#case 1>1<#case 2>2<#case 3>3<#case 4>4</#switch>"