Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
443d3627
提交
443d3627
authored
10月 09, 2017
作者:
plus33
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Skip only tests of function TO_CHAR and TO_DATE that are depending on
Local.ENGLISH (if test system is not Local.ENGLISH).
上级
ac8e3f14
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
33 行增加
和
32 行删除
+33
-32
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+33
-32
没有找到文件。
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
443d3627
...
@@ -1305,10 +1305,6 @@ public class TestFunctions extends TestBase implements AggregateFunction {
...
@@ -1305,10 +1305,6 @@ public class TestFunctions extends TestBase implements AggregateFunction {
}
}
private
void
testToDate
()
throws
ParseException
{
private
void
testToDate
()
throws
ParseException
{
if
(
Locale
.
getDefault
()
!=
Locale
.
ENGLISH
)
{
return
;
}
final
int
month
=
Calendar
.
getInstance
().
get
(
Calendar
.
MONTH
);
final
int
month
=
Calendar
.
getInstance
().
get
(
Calendar
.
MONTH
);
Date
date
=
null
;
Date
date
=
null
;
...
@@ -1418,6 +1414,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
...
@@ -1418,6 +1414,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
date
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
parse
(
"2013-01-29"
);
date
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
parse
(
"2013-01-29"
);
assertEquals
(
date
,
ToDateParser
.
toDate
(
"113029"
,
"J"
));
assertEquals
(
date
,
ToDateParser
.
toDate
(
"113029"
,
"J"
));
if
(
Locale
.
getDefault
()
==
Locale
.
ENGLISH
)
{
date
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss"
)
date
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss"
)
.
parse
(
"9999-12-31T23:59:59"
);
.
parse
(
"9999-12-31T23:59:59"
);
assertEquals
(
date
,
ToDateParser
.
toDate
(
"31-DEC-9999 23:59:59"
,
assertEquals
(
date
,
ToDateParser
.
toDate
(
"31-DEC-9999 23:59:59"
,
...
@@ -1436,6 +1433,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
...
@@ -1436,6 +1433,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
assertEquals
(
ymd
.
parse
(
"1950-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-50"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"1950-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-50"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"1999-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-99"
,
"DD-MON-RRRR"
));
assertEquals
(
ymd
.
parse
(
"1999-03-01"
),
ToDateParser
.
toDate
(
"1-MAR-99"
,
"DD-MON-RRRR"
));
}
}
}
private
static
void
setMonth
(
Date
date
,
int
month
)
{
private
static
void
setMonth
(
Date
date
,
int
month
)
{
Calendar
c
=
Calendar
.
getInstance
();
Calendar
c
=
Calendar
.
getInstance
();
...
@@ -1732,13 +1730,26 @@ public class TestFunctions extends TestBase implements AggregateFunction {
...
@@ -1732,13 +1730,26 @@ public class TestFunctions extends TestBase implements AggregateFunction {
"SELECT TO_CHAR(12345, '$999') FROM DUAL"
);
"SELECT TO_CHAR(12345, '$999') FROM DUAL"
);
assertResult
(
"######"
,
stat
,
assertResult
(
"######"
,
stat
,
"SELECT TO_CHAR(12345, '$9999') FROM DUAL"
);
"SELECT TO_CHAR(12345, '$9999') FROM DUAL"
);
assertResult
(
" "
+
cs
+
"12345"
,
stat
,
String
expected
=
String
.
format
(
"%,d"
,
12345
);
if
(
Locale
.
getDefault
()
==
Locale
.
ENGLISH
)
{
assertResult
(
String
.
format
(
"%5s12345"
,
cs
),
stat
,
"SELECT TO_CHAR(12345, '$99999999') FROM DUAL"
);
"SELECT TO_CHAR(12345, '$99999999') FROM DUAL"
);
assertResult
(
" "
+
cs
+
"12,345.35"
,
stat
,
assertResult
(
String
.
format
(
"%6s12,345.35"
,
cs
)
,
stat
,
"SELECT TO_CHAR(12345.345, '$99,999,999.99') FROM DUAL"
);
"SELECT TO_CHAR(12345.345, '$99,999,999.99') FROM DUAL"
);
String
expected
=
String
.
format
(
"%,d"
,
12345
);
assertResult
(
String
.
format
(
"%5s%s"
,
cs
,
expected
),
stat
,
assertResult
(
" "
+
cs
+
expected
,
stat
,
"SELECT TO_CHAR(12345.345, '$99g999g999') FROM DUAL"
);
"SELECT TO_CHAR(12345.345, '$99g999g999') FROM DUAL"
);
assertResult
(
" "
+
cs
+
"123.45"
,
stat
,
"SELECT TO_CHAR(123.45, 'L999.99') FROM DUAL"
);
assertResult
(
" -"
+
cs
+
"123.45"
,
stat
,
"SELECT TO_CHAR(-123.45, 'L999.99') FROM DUAL"
);
assertResult
(
cs
+
"123.45"
,
stat
,
"SELECT TO_CHAR(123.45, 'FML999.99') FROM DUAL"
);
assertResult
(
" "
+
cs
+
"123.45"
,
stat
,
"SELECT TO_CHAR(123.45, 'U999.99') FROM DUAL"
);
assertResult
(
" "
+
cs
+
"123.45"
,
stat
,
"SELECT TO_CHAR(123.45, 'u999.99') FROM DUAL"
);
}
assertResult
(
" 12,345.35"
,
stat
,
assertResult
(
" 12,345.35"
,
stat
,
"SELECT TO_CHAR(12345.345, '99,999,999.99') FROM DUAL"
);
"SELECT TO_CHAR(12345.345, '99,999,999.99') FROM DUAL"
);
assertResult
(
"12,345.35"
,
stat
,
assertResult
(
"12,345.35"
,
stat
,
...
@@ -1827,16 +1838,6 @@ public class TestFunctions extends TestBase implements AggregateFunction {
...
@@ -1827,16 +1838,6 @@ public class TestFunctions extends TestBase implements AggregateFunction {
"SELECT TO_CHAR(123.45, 'C999g999') FROM DUAL"
);
"SELECT TO_CHAR(123.45, 'C999g999') FROM DUAL"
);
assertResult
(
cc
+
"123.45"
,
stat
,
assertResult
(
cc
+
"123.45"
,
stat
,
"SELECT TO_CHAR(123.45, 'FMC999,999.99') FROM DUAL"
);
"SELECT TO_CHAR(123.45, 'FMC999,999.99') FROM DUAL"
);
assertResult
(
" "
+
cs
+
"123.45"
,
stat
,
"SELECT TO_CHAR(123.45, 'L999.99') FROM DUAL"
);
assertResult
(
" -"
+
cs
+
"123.45"
,
stat
,
"SELECT TO_CHAR(-123.45, 'L999.99') FROM DUAL"
);
assertResult
(
cs
+
"123.45"
,
stat
,
"SELECT TO_CHAR(123.45, 'FML999.99') FROM DUAL"
);
assertResult
(
" "
+
cs
+
"123.45"
,
stat
,
"SELECT TO_CHAR(123.45, 'U999.99') FROM DUAL"
);
assertResult
(
" "
+
cs
+
"123.45"
,
stat
,
"SELECT TO_CHAR(123.45, 'u999.99') FROM DUAL"
);
expected
=
String
.
format
(
"%.2f"
,
0.33f
).
substring
(
1
);
expected
=
String
.
format
(
"%.2f"
,
0.33f
).
substring
(
1
);
assertResult
(
" "
+
expected
,
stat
,
assertResult
(
" "
+
expected
,
stat
,
"SELECT TO_CHAR(0.326, '99D99') FROM DUAL"
);
"SELECT TO_CHAR(0.326, '99D99') FROM DUAL"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论