You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by mauronunez <gi...@git.apache.org> on 2016/09/21 13:54:19 UTC

[GitHub] incubator-freemarker pull request #15: Configure Junit Tests Localization.

GitHub user mauronunez opened a pull request:

    https://github.com/apache/incubator-freemarker/pull/15

    Configure Junit Tests Localization. 

    This allows testing in machines with a different locale ( mine is es_cl )

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mauronunez/incubator-freemarker 2.3-gae

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-freemarker/pull/15.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #15
    
----
commit a05672add065fbae9c56d208c8c76501bad4a96e
Author: Mauricio N��ez <mn...@azurian.com>
Date:   2016-09-21T13:49:33Z

    Configure Junit Tests Localization. This allows testing in machines with a different locale ( mine is es_cl )

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-freemarker pull request #15: Configure Junit Tests Localization.

Posted by ddekany <gi...@git.apache.org>.
Github user ddekany commented on a diff in the pull request:

    https://github.com/apache/incubator-freemarker/pull/15#discussion_r94276527
  
    --- Diff: src/test/java/freemarker/manual/CustomFormatsExample.java ---
    @@ -49,7 +50,9 @@ public void aliases1() throws IOException, TemplateException {
     
             Map<String, TemplateDateFormatFactory> customDateFormats
                     = new HashMap<String, TemplateDateFormatFactory>();
    -        customDateFormats.put("fileDate", new AliasTemplateDateFormatFactory("dd/MMM/yy hh:mm a"));
    +        Map<Locale, String> m=new HashMap<Locale,String>();
    --- End diff --
    
    This change is should be unnecessary, because if you don't specify a locale `Map`, the specified default pattern will be used regardless of your locale. Does this test fail for you without the `Map`? That can be a symptom of some other bug then.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-freemarker pull request #15: Configure Junit Tests Localization.

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-freemarker/pull/15


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-freemarker pull request #15: Configure Junit Tests Localization.

Posted by ddekany <gi...@git.apache.org>.
Github user ddekany commented on a diff in the pull request:

    https://github.com/apache/incubator-freemarker/pull/15#discussion_r94276419
  
    --- Diff: src/test/java/freemarker/core/ObjectBuilderSettingsTest.java ---
    @@ -382,13 +382,7 @@ public void defaultObjectWrapperTest() throws Exception {
             assertFalse(bw.isExposeFields());
         }
     
    -    @Test
    --- End diff --
    
    I suppose this was deleted accidentally.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-freemarker pull request #15: Configure Junit Tests Localization.

Posted by ddekany <gi...@git.apache.org>.
Github user ddekany commented on a diff in the pull request:

    https://github.com/apache/incubator-freemarker/pull/15#discussion_r94276468
  
    --- Diff: src/test/java/freemarker/core/OutputFormatTest.java ---
    @@ -322,14 +322,14 @@ public void testAutoEscapingSettingLayers() throws Exception {
         public void testNumericalInterpolation() throws IOException, TemplateException {
             getConfiguration().setRegisteredCustomOutputFormats(Collections.singleton(DummyOutputFormat.INSTANCE));
             assertOutput(
    -                "<#ftl outputFormat='dummy'>#{1.5}; #{1.5; m3}; ${'a.b'}",
    +                "<#ftl outputFormat='dummy'><#setting locale='en_US'>#{1.5}; #{1.5; m3}; ${'a.b'}",
    --- End diff --
    
    That's a good catch, but the locale should be simply set once in the `Configuration`, rather that in each FTL snippet again and again. In fact, the `TemplateTest` should do that automatically, as it's pointless to run tests with a random locale.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-freemarker pull request #15: Configure Junit Tests Localization.

Posted by ddekany <gi...@git.apache.org>.
Github user ddekany commented on a diff in the pull request:

    https://github.com/apache/incubator-freemarker/pull/15#discussion_r94276569
  
    --- Diff: src/test/resources/freemarker/manual/CustomFormatsExample-alias1.ftlh ---
    @@ -16,6 +16,8 @@
       specific language governing permissions and limitations
       under the License.
     -->
    +<#setting locale="en_us">
    --- End diff --
    
    Indeed, but then the `locale` and `time_zone` should be set in the `ExamplesTest` class, rather that in each template. Especially because otherwise the examples can't be copy-paster from/to the Manual.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---