有 ruby Unit::Test 说出测试结果
我一直在使用内置的 OSX 'say' 命令来表示长时间运行的测试结束。简单又方便。
我想让它说出结果的最后一行,即“6 个测试,18 个断言,0 个失败,0 个错误”,但仍然保留正在进行的输出。有什么想法如何做到这一点?
我已经尝试过:
ruby overlay_test.rb | tail -n 1 | say
但这不会在发生时输出测试结果。
如果只显示该行的最后两部分“0 次失败,0 次错误”,则可加分。
I've been using the built-in OSX 'say' command to signal the end of long running tests. It's easy and convenient.
I'd like to make it speak the last line of the results which says "6 tests, 18 assertions, 0 failures, 0 errors" but still keep the ongoing output. Any ideas how to do this?
I've tried:
ruby overlay_test.rb | tail -n 1 | say
But that doesn't output the tests results as they happen.
Bonus points for making it say just the last two parts of the line "0 failures, 0 errors".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
tee
将输出定向到多个文件/进程(这里,say
和 STDOUT):为了获得好处,可以使用
删除您不想要的内容>sed
:You can use
tee
to direct output to multiple files/processes (here,say
and STDOUT):For the bonus, get rid of what you don't want with
sed
:谢谢!
tee
正是我所需要的。尽管获胜的命令是:因为我想在测试运行时看到的不仅仅是测试的最后一行。
Thanks!
tee
is just what I needed. Though the winning command turned out to be:since I wanted to see more than just the last line of the test when it runs.