提交 ea3496de authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Restore default locale in TestFunctions and add method to stip trailing period from months

上级 a56a554a
...@@ -1497,7 +1497,8 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -1497,7 +1497,8 @@ public class TestFunctions extends TestBase implements AggregateFunction {
assertResult("1979-11-12 08:12:34.56", stat, "SELECT X FROM T"); assertResult("1979-11-12 08:12:34.56", stat, "SELECT X FROM T");
assertResult("-100-01-15 14:04:02.12", stat, "SELECT X FROM U"); assertResult("-100-01-15 14:04:02.12", stat, "SELECT X FROM U");
String expected = String.format(Locale.US, "%tb", timestamp1979).toUpperCase(); String expected = String.format("%tb", timestamp1979).toUpperCase();
expected = stripTrailingPeriod(expected);
assertResult("12-" + expected + "-79 08.12.34.560000 AM", stat, assertResult("12-" + expected + "-79 08.12.34.560000 AM", stat,
"SELECT TO_CHAR(X) FROM T"); "SELECT TO_CHAR(X) FROM T");
assertResult("- / , . ; : text - /", stat, assertResult("- / , . ; : text - /", stat,
...@@ -1617,7 +1618,8 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -1617,7 +1618,8 @@ public class TestFunctions extends TestBase implements AggregateFunction {
assertResult("11", stat, "SELECT TO_CHAR(X, 'Mm') FROM T"); assertResult("11", stat, "SELECT TO_CHAR(X, 'Mm') FROM T");
assertResult("11", stat, "SELECT TO_CHAR(X, 'mM') FROM T"); assertResult("11", stat, "SELECT TO_CHAR(X, 'mM') FROM T");
assertResult("11", stat, "SELECT TO_CHAR(X, 'mm') FROM T"); assertResult("11", stat, "SELECT TO_CHAR(X, 'mm') FROM T");
expected = String.format(Locale.US, "%1$tb", timestamp1979); expected = String.format("%1$tb", timestamp1979);
expected = stripTrailingPeriod(expected);
expected = expected.substring(0, 1).toUpperCase() + expected.substring(1); expected = expected.substring(0, 1).toUpperCase() + expected.substring(1);
assertResult(expected.toUpperCase(), stat, assertResult(expected.toUpperCase(), stat,
"SELECT TO_CHAR(X, 'MON') FROM T"); "SELECT TO_CHAR(X, 'MON') FROM T");
...@@ -1672,6 +1674,14 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -1672,6 +1674,14 @@ public class TestFunctions extends TestBase implements AggregateFunction {
conn.close(); conn.close();
} }
String stripTrailingPeriod(String expected) {
// CLDR provider appends period on some locales
int l = expected.length() - 1;
if (expected.charAt(l) == '.')
expected = expected.substring(0, l);
return expected;
}
private void testIfNull() throws SQLException { private void testIfNull() throws SQLException {
deleteDb("functions"); deleteDb("functions");
Connection conn = getConnection("functions"); Connection conn = getConnection("functions");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论