dqc3469 2016-08-07 18:11
浏览 7

去测试特定的文件输出

I'm new in Go and trying to work on a project. The structure of the code is like

handlers/
  -time.go
  -time_test.go

I've already tried go build, make (project) name

The thing is, I want to add some console output inside the code so that I know if a branch is covered or not (or for debugging). Right now, it doesn't work for me.

If I use:

go test -run test_file_path

If will just output

Pass        0.009s

Even I putt.Log("print log") or even fmt.Print("Say Hello") inside the test function.

If I just use go test -v test_file_path I would have undefined variables. The build & test would fail.

Any suggestions? Thanks!g

  • 写回答

1条回答 默认 最新

  • dras2334 2016-08-09 09:00
    关注

    Just go test ./handlers -v. The handlers is the package path.

    评论

报告相同问题?

悬赏问题

  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 MATLAB中streamslice问题
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序