技术控

    今日:0| 主题:63445
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] patter: `go test -v` as TAP output

[复制链接]
我的闺蜜会发光 发表于 2016-9-30 16:02:43
154 1
patter

  Output's    go test -vas TAP.  
  Usage

  1. usage: patter
复制代码
Patter has no arguments. It reads from STDIN, the output of    go test -v, and outputs    TAP v13compatible output.  
  Example

  Suppose the current directory has a test file,    foo_test.go. Running    go test -v ./...might produce the following output:  
  1. $ go test -v ./...
  2. === RUN   TestSkip
  3. --- SKIP: TestSkip (0.00s)
  4.     foo_test.go:6: this test is being skipped
  5. === RUN   TestError
  6. --- FAIL: TestError (0.00s)
  7.     foo_test.go:10: this test is erroring
  8. === RUN   Test2Errors
  9. --- FAIL: Test2Errors (0.00s)
  10.     foo_test.go:14: this test is error 1
  11.     foo_test.go:15: this test is error 2
  12. === RUN   TestFatal
  13. --- FAIL: TestFatal (0.00s)
  14.     foo_test.go:19: this test is fataling
  15. === RUN   TestOK
  16. --- PASS: TestOK (0.00s)
  17. FAIL
  18. exit status 1
  19. FAIL    github.com/apg/patter   0.007s
复制代码
If we, instead, pipe the output of    go test -v ./...into    patter, we get the following output:  
  1. $ go test -v ./... | patter
  2. TAP version 13
  3. ok 1 # skip TestSkip (0.00s)
  4. # foo_test.go:6: this test is being skipped
  5. not ok 2 - TestError (0.00s)
  6. # foo_test.go:10: this test is erroring
  7. not ok 3 - Test2Error (0.00s)
  8. # foo_test.go:14: this test is error 1
  9. # foo_test.go:15: this test is error 2
  10. not ok 4 - TestFatal (0.00s)
  11. # foo_test.go:19: this test is fataling
  12. ok 5 - TestOK (0.00s)
  13. 1..5
复制代码
Because    patterdoesn't know how many tests will be run, it outputs the plan line (e.g. 1..5) at the end. This is allowed via the spec.  
  Bailing out!

  It's possible that    patterwill encounter I/O errors while reading from STDIN. If this happens, patter    bails outusing the special words    Bail out!followed by an error message. This is the expected emergency behaviour of TAP.  
  Contributing

  Contributions are welcome, and encouraged! Please open an issue before a Pull Request to avoid duplicated effort, and/or functionality that will not be merged.
  Copyright

  (c) 2016, Andrew Gwozdziewycz    [email protected]  
  See LICENSE file for more information.
回复

使用道具 举报

贾一兰 发表于 2016-9-30 23:55:44
恋爱就是无数个饭局,结婚就是一个饭局。  
回复 支持 反对

使用道具 举报

我要投稿

推荐阅读


回页顶回复上一篇下一篇回列表
手机版/c.CoLaBug.com ( 粤ICP备05003221号 | 粤公网安备 44010402000842号 )

© 2001-2017 Comsenz Inc.

返回顶部 返回列表