@@ -62,6 +62,9 @@ func (s *testTimeSuite) TestDateTime(c *C) {
6262 {"170102036" , "2017-01-02 03:06:00" },
6363 {"170102039." , "2017-01-02 03:09:00" },
6464 {"170102037.11" , "2017-01-02 03:07:11.00" },
65+ {"2018.01.01" , "2018-01-01 00:00:00.00" },
66+ {"2018/01/01-00:00:00" , "2018-01-01 00:00:00" },
67+ {"2018.01.01 00:00:00" , "2018-01-01 00:00:00" },
6568 }
6669
6770 for _ , test := range table {
@@ -83,6 +86,9 @@ func (s *testTimeSuite) TestDateTime(c *C) {
8386 {"2017-01-05 23:59:59.575601" , 0 , "2017-01-06 00:00:00" },
8487 {"2017-01-31 23:59:59.575601" , 0 , "2017-02-01 00:00:00" },
8588 {"2017-00-05 23:59:58.575601" , 3 , "2017-00-05 23:59:58.576" },
89+ {"2017.00.05 23:59:58.575601" , 3 , "2017-00-05 23:59:58.576" },
90+ {"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" },
8692 }
8793
8894 for _ , test := range fspTbl {
@@ -103,6 +109,8 @@ func (s *testTimeSuite) TestDateTime(c *C) {
103109 "1000-09-31 00:00:00" ,
104110 "1001-02-29 00:00:00" ,
105111 "20170118.999" ,
112+ "2018-01" ,
113+ "2018.01" ,
106114 }
107115
108116 for _ , test := range errTable {
@@ -152,6 +160,8 @@ func (s *testTimeSuite) TestDate(c *C) {
152160 {"2015-06-01 12:12:12" , "2015-06-01" },
153161 {"0001-01-01 00:00:00" , "0001-01-01" },
154162 {"0001-01-01" , "0001-01-01" },
163+ {"2019.01.01" , "2019-01-01" },
164+ {"2019/01/01" , "2019-01-01" },
155165 }
156166
157167 for _ , test := range table {
@@ -162,6 +172,7 @@ func (s *testTimeSuite) TestDate(c *C) {
162172
163173 errTable := []string {
164174 "0121231" ,
175+ "2019.01" ,
165176 }
166177
167178 for _ , test := range errTable {
@@ -1307,3 +1318,18 @@ func (s *testTimeSuite) TestGetFormatType(c *C) {
13071318 c .Assert (isDuration , Equals , true )
13081319 c .Assert (isDate , Equals , false )
13091320}
1321+
1322+ func (s * testTimeSuite ) TestgetFracIndex (c * C ) {
1323+ testCases := []struct {
1324+ str string
1325+ expectIndex int
1326+ }{
1327+ {"2019.01.01 00:00:00" , - 1 },
1328+ {"2019.01.01 00:00:00.1" , 19 },
1329+ {"12345.6" , 5 },
1330+ }
1331+ for _ , testCase := range testCases {
1332+ index := types .GetFracIndex (testCase .str )
1333+ c .Assert (index , Equals , testCase .expectIndex )
1334+ }
1335+ }
0 commit comments