Display Options
By default the Rust test harness hides output from test execution to
keep results readable. Test output can be recovered (e.g., for
debugging) by passing --nocapture to the test binaries:
cargo test -- --nocapture
Display Options
By default the Rust test harness hides output from test execution to
keep results readable. Test output can be recovered (e.g., for
debugging) by passing --nocapture to the test binaries:
cargo test -- --nocapture
评论区
写评论命令中间有个--感觉好孤独哈哈
--
👇
PaiGack: 其实就是这样运行
cargo test -- --nocapture
cargo help test
提示Display Options By default the Rust test harness hides output from test execution to keep results readable. Test output can be recovered (e.g., for debugging) by passing --nocapture to the test binaries: cargo test -- --nocapture
--
👇
PaiGack:
Run tests
运行tests
print
输出的,而直接cargo test
是没有print
输出其实就是这样运行
cargo test -- --nocapture
cargo help test
提示Display Options By default the Rust test harness hides output from test execution to keep results readable. Test output can be recovered (e.g., for debugging) by passing --nocapture to the test binaries: cargo test -- --nocapture
--
👇
PaiGack:
Run tests
运行tests
print
输出的,而直接cargo test
是没有print
输出如果用的 VS Code 试一试直接点击
Run tests
运行tests
这样是能够带print
输出的,而直接cargo test
是没有print
输出无论默认显示还是不显示,都不会让人满意。
测试少的人不满意没显示;测试多的人不满意显示。
别写测试了,所有人都满意。可以了吧:)
还是觉得略麻烦 都改配置了hhh
--
👇
苦瓜小仔: 你可以在项目的
.cargo/config.toml
写[alias] t = "test -- --nocapture"
使用
cargo t
改变成默认显示打印。https://doc.rust-lang.org/cargo/reference/config.html
你可以在项目的
.cargo/config.toml
写[alias] t = "test -- --nocapture"
使用
cargo t
改变成默认显示打印。https://doc.rust-lang.org/cargo/reference/config.html