知识卡片

普通读书笔记卡 · 6075.d.2

回归用例应先暴露原缺陷

理解等级:中级

修复缺陷前先建立会因该缺陷失败的用例,确认它能触发问题,再验证修复与防回归。配置相关代码还需覆盖支持的平台与关键feature组合。用例数量不是目标,重点是行为、边界和配置差异是否被实际检验。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Chapter 5. Tooling Testing Advice · 查看原书依据

      write a test that exhibits the bug before fixing the bug. That way you can be sure that the bug is fixed and that it won’t be accidentally reintroduced in the future. If your crate has features (Item 26), run tests over every possible combination of available features. More generally, if your crate includes any config-specific code (e.g., #[cfg(target_os = "

    参考来源

    - 位置:《Effective Rust 35 Specific Ways to Improve Your Rust Code (David Drysdale)》第5章《Testing Advice》(spine9;extracted/Effective Rust 35 Specific Ways to Improve Your Rust Code (David Drysdale)/_epub-src/OEBPS/ch05.html;u158-ch05-030)。 - 结论依据:原文在“write a test that exhibits the bug”附近的定义、例子或代码支撑本卡核心说明:修复缺陷前先建立会因该缺陷失败的用例,确认它能触发问题,再验证修复与防回归。边界按已读前提解释;示例未执行。 - 原始内容:write a test that exhibits the bug before fixing the bug. That way you can be sure that the bug is fixed and that it won’t be accidentally reintroduced in the future. If your crate has features (Item 26), run tests over every possible combination of available features. More generally, if your crate includes any config-specific code (e.g., #[cfg(target_os = "