Rust 程序设计语言 简体中文版 1.85.0
std::collections 中定义的所有公有项引入当前作用域。使用 glob 运算符时 请多加小心!Glob 会使得我们难以推导作用域中有什么名称和它们是在何处定义的。 glob 运算符经常用于测试模块 tests 中,这时会将所有内容引入作用域;我们将在第十一 章“如何编写测试”部分讲解。glob 运算符有时也用于 prelude 模式;查看标准库中的文档了解 这个模式的更多细节。 149/562Rust 文件名:src/lib.rs pub fn add(left: u64, right: u64) -> u64 { left + right } #[cfg(test)] mod tests { use super::*; #[test] fn it_works() { let result = add(2, 2); assert_eq 220/562Rust 程序设计语言 简体中文版 现在让我们只关注 it_works 函数本身。注意 fn 行之前的 #[test]:这个属性表明这是一个测 试函数,这样测试执行者就知道将其作为测试处理。tests 模块中也可以有非测试的函数来帮 助我们建立通用场景或进行常见操作,必须每次都标明哪些函数是测试。 示例函数体通过使用 assert_eq! 宏来断言 result(其中包含 2 加 2 的结果)等于0 码力 | 562 页 | 3.23 MB | 9 天前3Tornado 6.5 Documentation
Clears the IOLoop for the current thread. Intended primarily for use by test frameworks in between tests. Changed in version 5.0: This method also clears the current asyncio event loop. Deprecated since be cleaned up when the process exits. IOLoop.close is provided mainly for scenarios such as unit tests, which create and destroy a large number of IOLoops. An IOLoop must be completely stopped before restart the process. Intended to be used at the end of scripts like unit test runners, to run the tests again after any source file changes (but see also the command-line interface in main) tornado.autoreload0 码力 | 272 页 | 1.12 MB | 2 月前3Tornado 6.5 Documentation
Clears the IOLoop for the current thread.Intended primarily for use by test frameworks in between tests. Changed in version 5.0: This method also clears the current asyncio [https://docs.python.org/3/library/asyncio be cleaned up when the process exits. IOLoop.close is provided mainly for scenarios such as unit tests, which create and destroy a large number of IOLoops. An IOLoop must be completely stopped before restart the process. Intended to be used at the end of scripts like unit test runners, to run the tests again after any source file changes (but see also the command-line interface in main)tornado.autoreload0 码力 | 437 页 | 405.14 KB | 2 月前3
共 3 条
- 1