gpt4 book ai didi

ruby - 为什么我应该使用 assert_equal 而不是在 minitest 中使用相等运算符断言?

转载 作者:太空宇宙 更新时间:2023-11-03 18:11:02 26 4
gpt4 key购买 nike

我真的很喜欢 Minitest,它很简单,但我不明白为什么我应该使用 assert_equal 而不是带有 == 运算符的 assert .

如果我查看 Implementation assert_equal 方法的作用与我所说的等于运算符完全相同。

为什么我需要这一步而不是直接使用它?

我还认为它不会仅仅因为 equal 就更具可读性,因为 == 是非常 self 解释的。

最佳答案

我认为这只是一个选择问题,对我来说 assert_equal 看起来比使用 == 更具可读性>

assert_equal expect, actual

关于ruby - 为什么我应该使用 assert_equal 而不是在 minitest 中使用相等运算符断言?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34175800/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com