99 "os/exec"
1010 "strings"
1111 "testing"
12+ "time"
1213
1314 "github.com/fatih/color"
1415)
@@ -19,7 +20,8 @@ type pmyTestCase struct {
1920 Expected string `json:"expected"`
2021}
2122
22- func (c * pmyTestCase ) testSelf () (bool , error ) {
23+ func (c * pmyTestCase ) testSelf (t * testing.T ) (bool , error ) {
24+ start := time .Now ()
2325 out , err := exec .Command (
2426 "../shell/pmy_wrapper.zsh" ,
2527 c .Lbuffer ,
@@ -32,10 +34,12 @@ func (c *pmyTestCase) testSelf() (bool, error) {
3234
3335 res := strings .Replace (string (out ), "\n " , "" , - 1 )
3436 if res == c .Expected {
37+ elapsed := time .Since (start )
3538 fmt .Printf (
36- "[%v] pass; res: %v\n " ,
39+ "[%v] pass; { res: %v, elapsed: %v} \n " ,
3740 color .GreenString ("●" ),
3841 res ,
42+ elapsed ,
3943 )
4044 return true , nil
4145 }
@@ -73,7 +77,7 @@ func TestIntegration(t *testing.T) {
7377 byteValue , _ := ioutil .ReadAll (jsonFile )
7478 json .Unmarshal (byteValue , & cases )
7579 for _ , c := range cases {
76- if ok , err := c .testSelf (); ok {
80+ if ok , err := c .testSelf (t ); ok {
7781 continue
7882 } else if err == nil {
7983 t .Fail ()
0 commit comments