dsfdsf46465
2014-08-27 04:22 阅读 45
已采纳

有没有一种方法可以只对一个文件运行go测试?

I checked documentation and help tutorial. Didn't find answer.

I just want to run a_test.go not all *_test.go. Is this possible or how? thanks a lot!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    douzi4766 douzi4766 2014-08-27 05:07

    Command Documentation

    Command go

    Description of testing flags

    The following flags are recognized by the 'go test' command and control the execution of any test:

    -run regexp
        Run only those tests and examples matching the regular
        expression.
    

    To run the tests which satisfy the regex regular expression:

    go test -run=regexp
    
    点赞 评论 复制链接分享