TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Being Concrete in Tests

1 点作者 endorphine8 个月前
I remember reading in a book that in tests, you generally want to be concrete, not abstract. For example, you&#x27;d like to do:<p><pre><code> assert(response.status == 401) assert(error == &quot;param &#x27;foo&#x27; is invalid&quot;) </code></pre> instead of:<p><pre><code> assert(response.status == Http.StatusUnauthorized) assert(error == HttpError.InvalidParameter(&quot;foo&quot;)) </code></pre> Can anyone point me to resources (books, posts, tweets, whatever) that better illustrate this and justify it?

暂无评论

暂无评论