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 2015/09/29 02:23:11 UTC

incubator-freemarker git commit: (Test class name typo...)

Repository: incubator-freemarker
Updated Branches:
  refs/heads/2.3-gae c798862ac -> 0c3e1461f


(Test class name typo...)


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/0c3e1461
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/0c3e1461
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/0c3e1461

Branch: refs/heads/2.3-gae
Commit: 0c3e1461f937fa0115dd70a92c13ad1a0bd0e317
Parents: c798862
Author: ddekany <dd...@apache.org>
Authored: Tue Sep 29 02:23:05 2015 +0200
Committer: ddekany <dd...@apache.org>
Committed: Tue Sep 29 02:23:05 2015 +0200

----------------------------------------------------------------------
 .../freemarker/core/CoercionToTextualTest.java  | 119 +++++++++++++++++++
 .../freemarker/core/CorectionToTextualTest.java | 119 -------------------
 2 files changed, 119 insertions(+), 119 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/0c3e1461/src/test/java/freemarker/core/CoercionToTextualTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/core/CoercionToTextualTest.java b/src/test/java/freemarker/core/CoercionToTextualTest.java
new file mode 100644
index 0000000..c35ace6
--- /dev/null
+++ b/src/test/java/freemarker/core/CoercionToTextualTest.java
@@ -0,0 +1,119 @@
+package freemarker.core;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Date;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import freemarker.template.Configuration;
+import freemarker.template.SimpleDate;
+import freemarker.template.TemplateDateModel;
+import freemarker.template.TemplateException;
+import freemarker.template.TemplateModelException;
+import freemarker.test.TemplateTest;
+
+@SuppressWarnings("boxing")
+public class CoercionToTextualTest extends TemplateTest {
+    
+    /** 2015-09-06T12:00:00Z */
+    private static long T = 1441540800000L;
+    private static TemplateDateModel TM = new SimpleDate(new Date(T), TemplateDateModel.DATETIME);
+    
+    @Test
+    public void testBasicStringBuiltins() throws IOException, TemplateException {
+        assertOutput("${s?upperCase}", "ABC");
+        assertOutput("${n?string?lowerCase}", "1.50e+03");
+        assertErrorContains("${n?lowerCase}", "convert", "string", "markup", "text/html");
+        assertOutput("${dt?string?lowerCase}", "2015-09-06t12:00:00z");
+        assertErrorContains("${dt?lowerCase}", "convert", "string", "markup", "text/html");
+        assertOutput("${b?upperCase}", "Y");
+        assertErrorContains("${m?upperCase}", "convertible to string", "HTMLOutputModel");
+    }
+
+    @Test
+    public void testEscBuiltin() throws IOException, TemplateException {
+        Configuration cfg = getConfiguration();
+        cfg.setOutputFormat(HTMLOutputFormat.INSTANCE);
+        cfg.setAutoEscapingPolicy(Configuration.DISABLE_AUTO_ESCAPING_POLICY);
+        cfg.setBooleanFormat("<y>,<n>");
+        
+        assertOutput("${'a<b'?esc}", "a&lt;b");
+        assertOutput("${n?string?esc}", "1.50E+03");
+        assertOutput("${n?esc}", "1.50*10<sup>3</sup>");
+        assertOutput("${dt?string?esc}", "2015-09-06T12:00:00Z");
+        assertOutput("${dt?esc}", "2015-09-06<span class='T'>T</span>12:00:00Z");
+        assertOutput("${b?esc}", "&lt;y&gt;");
+        assertOutput("${m?esc}", "<p>M</p>");
+    }
+    
+    @Test
+    public void testStringOverloadedBuiltIns() throws IOException, TemplateException {
+        assertOutput("${s?contains('b')}", "y");
+        assertOutput("${n?string?contains('E')}", "y");
+        assertErrorContains("${n?contains('E')}", "convert", "string", "markup", "text/html");
+        assertErrorContains("${n?indexOf('E')}", "convert", "string", "markup", "text/html");
+        assertOutput("${dt?string?contains('0')}", "y");
+        assertErrorContains("${dt?contains('0')}", "convert", "string", "markup", "text/html");
+        assertErrorContains("${m?contains('0')}", "convertible to string", "HTMLOutputModel");
+        assertErrorContains("${m?indexOf('0')}", "convertible to string", "HTMLOutputModel");
+    }
+    
+    @Test
+    public void testMarkupStringBuiltIns() throws IOException, TemplateException {
+        assertErrorContains("${n?string?markupString}", "Expected", "markup", "string");
+        assertErrorContains("${n?markupString}", "Expected", "markup", "number");
+        assertErrorContains("${dt?markupString}", "Expected", "markup", "date");
+    }
+    
+    @Test
+    public void testSimpleInterpolation() throws IOException, TemplateException {
+        assertOutput("${s}", "abc");
+        assertOutput("${n?string}", "1.50E+03");
+        assertOutput("${n}", "1.50*10<sup>3</sup>");
+        assertOutput("${dt?string}", "2015-09-06T12:00:00Z");
+        assertOutput("${dt}", "2015-09-06<span class='T'>T</span>12:00:00Z");
+        assertOutput("${b}", "y");
+        assertOutput("${m}", "<p>M</p>");
+    }
+    
+    @Test
+    public void testConcatenation() throws IOException, TemplateException {
+        assertOutput("${s + '&'}", "abc&");
+        assertOutput("${n?string + '&'}", "1.50E+03&");
+        assertOutput("${n + '&'}", "1.50*10<sup>3</sup>&amp;");
+        assertOutput("${dt?string + '&'}", "2015-09-06T12:00:00Z&");
+        assertOutput("${dt + '&'}", "2015-09-06<span class='T'>T</span>12:00:00Z&amp;");
+        assertOutput("${b + '&'}", "y&");
+        assertOutput("${m + '&'}", "<p>M</p>&amp;");
+    }
+
+    @Test
+    public void testConcatenation2() throws IOException, TemplateException {
+        assertOutput("${'&' + s}", "&abc");
+        assertOutput("${'&' + n?string}", "&1.50E+03");
+        assertOutput("${'&' + n}", "&amp;1.50*10<sup>3</sup>");
+        assertOutput("${'&' + dt?string}", "&2015-09-06T12:00:00Z");
+        assertOutput("${'&' + dt}", "&amp;2015-09-06<span class='T'>T</span>12:00:00Z");
+        assertOutput("${'&' + b}", "&y");
+        assertOutput("${'&' + m}", "&amp;<p>M</p>");
+    }
+    
+    @Before
+    public void setup() throws TemplateModelException {
+        Configuration cfg = getConfiguration();
+        cfg.setCustomNumberFormats(Collections.singletonMap("G", PrintfGTemplateNumberFormatFactory.INSTANCE));
+        cfg.setCustomDateFormats(Collections.singletonMap("HI", HTMLISOTemplateDateFormatFactory.INSTANCE));
+        cfg.setNumberFormat("@G 3");
+        cfg.setDateTimeFormat("@HI");
+        cfg.setBooleanFormat("y,n");
+        
+        addToDataModel("s", "abc");
+        addToDataModel("n", 1500);
+        addToDataModel("dt", TM);
+        addToDataModel("b", Boolean.TRUE);
+        addToDataModel("m", HTMLOutputFormat.INSTANCE.fromMarkup("<p>M</p>"));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/0c3e1461/src/test/java/freemarker/core/CorectionToTextualTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/core/CorectionToTextualTest.java b/src/test/java/freemarker/core/CorectionToTextualTest.java
deleted file mode 100644
index 968981a..0000000
--- a/src/test/java/freemarker/core/CorectionToTextualTest.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package freemarker.core;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Date;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import freemarker.template.Configuration;
-import freemarker.template.SimpleDate;
-import freemarker.template.TemplateDateModel;
-import freemarker.template.TemplateException;
-import freemarker.template.TemplateModelException;
-import freemarker.test.TemplateTest;
-
-@SuppressWarnings("boxing")
-public class CorectionToTextualTest extends TemplateTest {
-    
-    /** 2015-09-06T12:00:00Z */
-    private static long T = 1441540800000L;
-    private static TemplateDateModel TM = new SimpleDate(new Date(T), TemplateDateModel.DATETIME);
-    
-    @Test
-    public void testBasicStringBuiltins() throws IOException, TemplateException {
-        assertOutput("${s?upperCase}", "ABC");
-        assertOutput("${n?string?lowerCase}", "1.50e+03");
-        assertErrorContains("${n?lowerCase}", "convert", "string", "markup", "text/html");
-        assertOutput("${dt?string?lowerCase}", "2015-09-06t12:00:00z");
-        assertErrorContains("${dt?lowerCase}", "convert", "string", "markup", "text/html");
-        assertOutput("${b?upperCase}", "Y");
-        assertErrorContains("${m?upperCase}", "convertible to string", "HTMLOutputModel");
-    }
-
-    @Test
-    public void testEscBuiltin() throws IOException, TemplateException {
-        Configuration cfg = getConfiguration();
-        cfg.setOutputFormat(HTMLOutputFormat.INSTANCE);
-        cfg.setAutoEscapingPolicy(Configuration.DISABLE_AUTO_ESCAPING_POLICY);
-        cfg.setBooleanFormat("<y>,<n>");
-        
-        assertOutput("${'a<b'?esc}", "a&lt;b");
-        assertOutput("${n?string?esc}", "1.50E+03");
-        assertOutput("${n?esc}", "1.50*10<sup>3</sup>");
-        assertOutput("${dt?string?esc}", "2015-09-06T12:00:00Z");
-        assertOutput("${dt?esc}", "2015-09-06<span class='T'>T</span>12:00:00Z");
-        assertOutput("${b?esc}", "&lt;y&gt;");
-        assertOutput("${m?esc}", "<p>M</p>");
-    }
-    
-    @Test
-    public void testStringOverloadedBuiltIns() throws IOException, TemplateException {
-        assertOutput("${s?contains('b')}", "y");
-        assertOutput("${n?string?contains('E')}", "y");
-        assertErrorContains("${n?contains('E')}", "convert", "string", "markup", "text/html");
-        assertErrorContains("${n?indexOf('E')}", "convert", "string", "markup", "text/html");
-        assertOutput("${dt?string?contains('0')}", "y");
-        assertErrorContains("${dt?contains('0')}", "convert", "string", "markup", "text/html");
-        assertErrorContains("${m?contains('0')}", "convertible to string", "HTMLOutputModel");
-        assertErrorContains("${m?indexOf('0')}", "convertible to string", "HTMLOutputModel");
-    }
-    
-    @Test
-    public void testMarkupStringBuiltIns() throws IOException, TemplateException {
-        assertErrorContains("${n?string?markupString}", "Expected", "markup", "string");
-        assertErrorContains("${n?markupString}", "Expected", "markup", "number");
-        assertErrorContains("${dt?markupString}", "Expected", "markup", "date");
-    }
-    
-    @Test
-    public void testSimpleInterpolation() throws IOException, TemplateException {
-        assertOutput("${s}", "abc");
-        assertOutput("${n?string}", "1.50E+03");
-        assertOutput("${n}", "1.50*10<sup>3</sup>");
-        assertOutput("${dt?string}", "2015-09-06T12:00:00Z");
-        assertOutput("${dt}", "2015-09-06<span class='T'>T</span>12:00:00Z");
-        assertOutput("${b}", "y");
-        assertOutput("${m}", "<p>M</p>");
-    }
-    
-    @Test
-    public void testConcatenation() throws IOException, TemplateException {
-        assertOutput("${s + '&'}", "abc&");
-        assertOutput("${n?string + '&'}", "1.50E+03&");
-        assertOutput("${n + '&'}", "1.50*10<sup>3</sup>&amp;");
-        assertOutput("${dt?string + '&'}", "2015-09-06T12:00:00Z&");
-        assertOutput("${dt + '&'}", "2015-09-06<span class='T'>T</span>12:00:00Z&amp;");
-        assertOutput("${b + '&'}", "y&");
-        assertOutput("${m + '&'}", "<p>M</p>&amp;");
-    }
-
-    @Test
-    public void testConcatenation2() throws IOException, TemplateException {
-        assertOutput("${'&' + s}", "&abc");
-        assertOutput("${'&' + n?string}", "&1.50E+03");
-        assertOutput("${'&' + n}", "&amp;1.50*10<sup>3</sup>");
-        assertOutput("${'&' + dt?string}", "&2015-09-06T12:00:00Z");
-        assertOutput("${'&' + dt}", "&amp;2015-09-06<span class='T'>T</span>12:00:00Z");
-        assertOutput("${'&' + b}", "&y");
-        assertOutput("${'&' + m}", "&amp;<p>M</p>");
-    }
-    
-    @Before
-    public void setup() throws TemplateModelException {
-        Configuration cfg = getConfiguration();
-        cfg.setCustomNumberFormats(Collections.singletonMap("G", PrintfGTemplateNumberFormatFactory.INSTANCE));
-        cfg.setCustomDateFormats(Collections.singletonMap("HI", HTMLISOTemplateDateFormatFactory.INSTANCE));
-        cfg.setNumberFormat("@G 3");
-        cfg.setDateTimeFormat("@HI");
-        cfg.setBooleanFormat("y,n");
-        
-        addToDataModel("s", "abc");
-        addToDataModel("n", 1500);
-        addToDataModel("dt", TM);
-        addToDataModel("b", Boolean.TRUE);
-        addToDataModel("m", HTMLOutputFormat.INSTANCE.fromMarkup("<p>M</p>"));
-    }
-
-}