#unit-testing #ms #mechnisem

dev timebomb

单元测试的超时机制

3 个版本

使用旧的 Rust 2015

0.1.2 2015年4月30日
0.1.1 2015年4月26日
0.1.0 2015年4月26日

647测试 中排名 #647

Download history · Rust 包仓库 82/week @ 2024-03-03 · Rust 包仓库 73/week @ 2024-03-10 · Rust 包仓库 86/week @ 2024-03-17 · Rust 包仓库 132/week @ 2024-03-24 · Rust 包仓库 152/week @ 2024-03-31 · Rust 包仓库 57/week @ 2024-04-07 · Rust 包仓库 74/week @ 2024-04-14 · Rust 包仓库 78/week @ 2024-04-21 · Rust 包仓库 69/week @ 2024-04-28 · Rust 包仓库 64/week @ 2024-05-05 · Rust 包仓库 76/week @ 2024-05-12 · Rust 包仓库 66/week @ 2024-05-19 · Rust 包仓库 102/week @ 2024-05-26 · Rust 包仓库 87/week @ 2024-06-02 · Rust 包仓库 58/week @ 2024-06-09 · Rust 包仓库 118/week @ 2024-06-16 · Rust 包仓库

每月下载量 376
用于 少于 9 个 工具包

Apache-2.0 协议

5KB

Timebomb

Build Status

这是一个简单的 Rust 超时机制,旨在用于单元测试。

extern crate timebomb;
use timebomb::timeout_ms;

#[test]
fn something_bad() {
	// This will timeout in 1 second if the test did not pass
	timeout_ms(|| {
		// oops infinite loop
		loop {}
	}, 1000);
}

依赖项

~0.9–1.3MB
~18K SLoC