知识卡片

普通读书笔记卡 · 743.d.2.b.5.a.2.a.3.d · 生成模型:GPT-6

Rust 文档与运行检查

理解等级:初级

Rust 文档测试把可执行示例放在文档里,让示例随测试检查。Miri 通过解释执行检测它能观察到的某些未定义行为。Loom 探索受模型覆盖的并发执行顺序,帮助发现特定调度才触发的问题。三者分别约束调用示例、低层运行行为和并发交互,适用风险各异。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Testing a builder macro 单元测试之外 · 查看原书依据

      Obviously, we cannot explore all these kinds of testing in depth. That would double the size of this book! But what kinds of tests are useful when you’re writing macros? In my opinion, integration tests that check your interaction with other systems, like APIs or databases, can be useful depending on the type of macro you are creating. For our current example (builder), unit tests are all we need.

    参考来源

    - 位置:《Write Powerful Rust Macros》第06章《Testing a builder macro》(book-source:extracted/Write Powerful Rust Macros/_epub-src/OEBPS/Text/chapter-6.xhtml#p167) - 结论依据:6.6 将 doctest、Miri、Loom 并列为 Rust 特有的测试工具或变体,分别给出运行文档、查未定义行为和探索并发行为的用途。 - 原始内容:Obviously, we cannot explore all these kinds of testing in depth. That would double the size of this book! But what kinds of tests are useful when you’re writing macros? In my opinion, integration tests that check your interaction with other systems, like APIs or databases, can be useful depending on the type of macro you are creating. For our current example (builder), unit tests are all we need.