You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2016/06/22 08:56:46 UTC

[4/5] struts git commit: Adds test to guard pre-evaulation of name attribute

Adds test to guard pre-evaulation of name attribute


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/c84810ff
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/c84810ff
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/c84810ff

Branch: refs/heads/support-2-3
Commit: c84810ff8233c953146d52731e92090eb07746f5
Parents: 2ea59b3
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Jun 22 10:46:09 2016 +0200
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Jun 22 10:46:09 2016 +0200

----------------------------------------------------------------------
 .../apache/struts2/views/jsp/ui/TextfieldTest.java  | 16 ++++++++++++++++
 .../apache/struts2/views/jsp/ui/Textfield-12.txt    |  4 ++++
 2 files changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/c84810ff/core/src/test/java/org/apache/struts2/views/jsp/ui/TextfieldTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/views/jsp/ui/TextfieldTest.java b/core/src/test/java/org/apache/struts2/views/jsp/ui/TextfieldTest.java
index e1a81c4..5ccfe32 100644
--- a/core/src/test/java/org/apache/struts2/views/jsp/ui/TextfieldTest.java
+++ b/core/src/test/java/org/apache/struts2/views/jsp/ui/TextfieldTest.java
@@ -281,4 +281,20 @@ public class TextfieldTest extends AbstractUITagTest {
         verify(TextFieldTag.class.getResource("Textfield-11.txt"));
     }
 
+    public void testNameEvaluation() throws Exception {
+        TestAction testAction = (TestAction) action;
+        testAction.setArray(new String[]{"test", "bar"});
+        testAction.setFooInt(1);
+
+        TextFieldTag tag = new TextFieldTag();
+        tag.setPageContext(pageContext);
+        tag.setName("array[%{fooInt}]");
+
+        tag.doStartTag();
+        tag.doEndTag();
+
+        verify(TextFieldTag.class.getResource("Textfield-12.txt"));
+    }
+
+
 }

http://git-wip-us.apache.org/repos/asf/struts/blob/c84810ff/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textfield-12.txt
----------------------------------------------------------------------
diff --git a/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textfield-12.txt b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textfield-12.txt
new file mode 100644
index 0000000..44e9eb3
--- /dev/null
+++ b/core/src/test/resources/org/apache/struts2/views/jsp/ui/Textfield-12.txt
@@ -0,0 +1,4 @@
+<tr>
+  <td class="tdLabel"></td>
+  <td><input type="text" name="array[1]" value="bar" id="array_1_"/></td>
+</tr>
\ No newline at end of file