Menu

#1066 Gradle: HTMLFilter2Test failed on non-English OS

5.8
closed-fixed
nobody
None
5
2023-09-27
2021-08-23
No

When running gradle test, HTMLFilter2Test#testLoad failed on non-English platform

expected:<[Tag: HTML Attribute:] lang> but was:<[要素: HTML 属性:] lang>
Expected :Tag: HTML Attribute: lang
Actual   :要素: HTML 属性: lang
<Click to see difference>

org.junit.ComparisonFailure: expected:<[Tag: HTML Attribute:] lang> but was:<[要素: HTML 属性:] lang>
    at org.junit.Assert.assertEquals(Assert.java:117)
    at org.junit.Assert.assertEquals(Assert.java:146)
    at org.omegat.filters.TestFilterBase.checkMulti(TestFilterBase.java:465)
    at org.omegat.filters.HTMLFilter2Test.testLoad(HTMLFilter2Test.java:69)

It is because filters2/html2/FilterVisitor class got localized message for the target string.
```
String comment = OStrings.getString("HTMLFILTER_TAG") + " " + tag.getTagName() + " "

                + OStrings.getString("HTMLFILTER_ATTRIBUTE") + " " + key;

```

It is better to configure Gradle to set language to English for running test.

Discussion

  • Aaron Madlon-Kay

    If the test is testing the comment, and the comment is intended to be localized, then the test should account for that.

     
  • Hiroshi Miura

    Hiroshi Miura - 2021-08-23

    There is alternative solution that change a test case expectation

            checkMulti("en", null, null, "", "This is first line.",
                    OStrings.getString("HTMLFILTER_TAG") +" HTML "
    
                                + OStrings.getString("HTMLFILTER_ATTRIBUTE") + " lang");
    
     
  • Hiroshi Miura

    Hiroshi Miura - 2022-10-07
    • status: open --> open-fixed
    • Group: 5.6 --> 5.8
     
  • Hiroshi Miura

    Hiroshi Miura - 2022-10-07

    merged [30dfa5]

     

    Related

    Commit: [30dfa5]

  • Hiroshi Miura

    Hiroshi Miura - 2023-09-27
    • status: open-fixed --> closed-fixed
     
  • Hiroshi Miura

    Hiroshi Miura - 2023-09-27

    released 6.0

     

Log in to post a comment.

MongoDB Logo MongoDB