@@ -513,23 +513,25 @@ func Test_convert_to_p4_client_path(t *testing.T) {
513
513
}
514
514
515
515
func Test_p4_run_command_global_parameters (t * testing.T ) {
516
- p , _ := newP4Impl (inMemoryDepotInit , "/basedir" , true )
516
+ p , _ := newP4Impl (inMemoryDepotInit , filepath . FromSlash ( "/basedir" ) , true )
517
517
p .clientName = "test_client"
518
+ var cmdParams []string
518
519
p .runP4Function = func (params ... string ) (out []byte , err error ) {
519
- return []byte (fmt .Sprintf ("%v" , params )), nil
520
+ cmdParams = params
521
+ return nil , nil
520
522
}
521
- output , _ : = p .runP4 ()
522
- assert .Equal (t , "[-d /basedir -c test_client]" , string ( output ) )
523
+ _ , _ = p .runP4 ()
524
+ assert .Equal (t , [] string { "-d" , filepath . FromSlash ( " /basedir" ), "-c" , " test_client" }, cmdParams )
523
525
}
524
526
525
527
func Test_p4_trace_command_global_parameters (t * testing.T ) {
526
- p , _ := newP4Impl (inMemoryDepotInit , "/basedir" , true )
528
+ p , _ := newP4Impl (inMemoryDepotInit , filepath . FromSlash ( "/basedir" ) , true )
527
529
p .clientName = "test_client"
528
- var trace string
530
+ var cmdParams [] string
529
531
p .traceP4Function = func (params ... string ) (err error ) {
530
- trace = fmt . Sprintf ( "%v" , params )
532
+ cmdParams = params
531
533
return nil
532
534
}
533
535
_ = p .traceP4 ()
534
- assert .Equal (t , "[-d /basedir -c test_client]" , trace )
536
+ assert .Equal (t , [] string { "-d" , filepath . FromSlash ( " /basedir" ), "-c" , " test_client" }, cmdParams )
535
537
}
0 commit comments