@@ -150,6 +150,7 @@ func TestParseScript_listAndMapParams(t *testing.T) {
150150 optional2 string
151151 list1 []time.Duration
152152 list2 []int
153+ list3 []time.Time
153154 emptyList []float64
154155 map1 map [string ]string
155156 map2 map [string ]int
@@ -165,6 +166,7 @@ func TestParseScript_listAndMapParams(t *testing.T) {
165166 func (pipeline * bitflow.SamplePipeline , params map [string ]interface {}) error {
166167 list1 = params ["list1" ].([]time.Duration )
167168 list2 = params ["list2" ].([]int )
169+ list3 = params ["list3" ].([]time.Time )
168170 map1 = params ["map1" ].(map [string ]string )
169171 map2 = params ["map2" ].(map [string ]int )
170172 emptyMap = params ["emptyMap" ].(map [string ]float64 )
@@ -181,6 +183,7 @@ func TestParseScript_listAndMapParams(t *testing.T) {
181183 }, "step with list and map parameters" ).
182184 Required ("list1" , reg .List (reg .Duration ())).
183185 Required ("list2" , reg .List (reg .Int ())).
186+ Required ("list3" , reg .List (reg .Time ())).
184187 Required ("map1" , reg .Map (reg .String ())).
185188 Required ("map2" , reg .Map (reg .Int ())).
186189 Required ("emptyMap" , reg .Map (reg .Float ())).
@@ -196,7 +199,7 @@ func TestParseScript_listAndMapParams(t *testing.T) {
196199
197200 testScript := "special_params(list2=[ 1,'2',3], map1 = { x=y, 1=2, ' '=v } , list1 = [1s ,2h, 3m] " +
198201 ", map2 = { 4=5 }, emptyList=[], emptyMap={}, optionalList2= [50,60], optionalMap1={ g=40, h=60 }," +
199- "normal1= 'true', 'normal2'= 33, optional1= 3.444)"
202+ "normal1= 'true', 'normal2'= 33, optional1= 3.444, list3=['2100-10-10 10:10:10.123456', '1990-05-06 07:15:06.1'] )"
200203 _ , errs := parser .ParseScript (testScript )
201204 assert .NoError (errs .NilOrError ())
202205
@@ -214,6 +217,11 @@ func TestParseScript_listAndMapParams(t *testing.T) {
214217 assert .Equal (33 , normal2 )
215218 assert .Equal (3.444 , optional1 )
216219 assert .Equal ("defaultVal2" , optional2 )
220+
221+ assert .Len (list3 , 2 )
222+ format := "2006-01-02 15:04:05.999999"
223+ assert .Equal (time .Date (2100 , time .October , 10 , 10 , 10 , 10 , 123456 * 1000 , time .Local ).Format (format ), list3 [0 ].Format (format ))
224+ assert .Equal (time .Date (1990 , time .May , 6 , 7 , 15 , 06 , 100 * 1000 * 1000 , time .Local ).Format (format ), list3 [1 ].Format (format ))
217225}
218226
219227func createTestParser () (BitflowScriptParser , * testOutputCatcher ) {
0 commit comments