@@ -64,6 +64,9 @@ func (s *testTimeSuite) TestDateTime(c *C) {
6464 {"170102037.11" , "2017-01-02 03:07:11.00" },
6565 {"2018-01-01 18" , "2018-01-01 18:00:00" },
6666 {"18-01-01 18" , "2018-01-01 18:00:00" },
67+ {"2018.01.01" , "2018-01-01 00:00:00.00" },
68+ {"2018.01.01 00:00:00" , "2018-01-01 00:00:00" },
69+ {"2018/01/01-00:00:00" , "2018-01-01 00:00:00" },
6770 }
6871
6972 for _ , test := range table {
@@ -85,6 +88,9 @@ func (s *testTimeSuite) TestDateTime(c *C) {
8588 {"2017-01-05 23:59:59.575601" , 0 , "2017-01-06 00:00:00" },
8689 {"2017-01-31 23:59:59.575601" , 0 , "2017-02-01 00:00:00" },
8790 {"2017-00-05 23:59:58.575601" , 3 , "2017-00-05 23:59:58.576" },
91+ {"2017.00.05 23:59:58.575601" , 3 , "2017-00-05 23:59:58.576" },
92+ {"2017/00/05 23:59:58.575601" , 3 , "2017-00-05 23:59:58.576" },
93+ {"2017/00/05-23:59:58.575601" , 3 , "2017-00-05 23:59:58.576" },
8894 }
8995
9096 for _ , test := range fspTbl {
@@ -105,6 +111,8 @@ func (s *testTimeSuite) TestDateTime(c *C) {
105111 "1000-09-31 00:00:00" ,
106112 "1001-02-29 00:00:00" ,
107113 "20170118.999" ,
114+ "2018-01" ,
115+ "2018.01" ,
108116 }
109117
110118 for _ , test := range errTable {
@@ -154,6 +162,8 @@ func (s *testTimeSuite) TestDate(c *C) {
154162 {"2015-06-01 12:12:12" , "2015-06-01" },
155163 {"0001-01-01 00:00:00" , "0001-01-01" },
156164 {"0001-01-01" , "0001-01-01" },
165+ {"2019.01.01" , "2019-01-01" },
166+ {"2019/01/01" , "2019-01-01" },
157167 }
158168
159169 for _ , test := range table {
@@ -164,6 +174,7 @@ func (s *testTimeSuite) TestDate(c *C) {
164174
165175 errTable := []string {
166176 "0121231" ,
177+ "2019.01" ,
167178 }
168179
169180 for _ , test := range errTable {
@@ -1311,3 +1322,18 @@ func (s *testTimeSuite) TestGetFormatType(c *C) {
13111322 c .Assert (isDuration , Equals , true )
13121323 c .Assert (isDate , Equals , false )
13131324}
1325+
1326+ func (s * testTimeSuite ) TestgetFracIndex (c * C ) {
1327+ testCases := []struct {
1328+ str string
1329+ expectIndex int
1330+ }{
1331+ {"2019.01.01 00:00:00" , - 1 },
1332+ {"2019.01.01 00:00:00.1" , 19 },
1333+ {"12345.6" , 5 },
1334+ }
1335+ for _ , testCase := range testCases {
1336+ index := types .GetFracIndex (testCase .str )
1337+ c .Assert (index , Equals , testCase .expectIndex )
1338+ }
1339+ }
0 commit comments