scala 测试中的 should 和 must 有什么区别? [英] What is the difference between should and must in scala testing?

查看:91
本文介绍了scala 测试中的 should 和 must 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

scalatest 和 Specs2 都有单独的 shouldmust 匹配器.

Both scalatest and Specs2 have separate matchers for should and must.

但是,我找不到任何解释为什么您会使用其中一个.

However, I cannot find any explanation for why you would use one or the other.

究竟有什么区别?

推荐答案

没有区别,这纯粹是一种语法偏好.我个人更喜欢在 specs2 中使用 must 因为我认为 should 会让人们认为期望是可选的.

There is no difference, this is purely a syntactic preference. I personally prefer to use must in specs2 because I think that should can make people think that an expectation is optional.

这篇关于scala 测试中的 should 和 must 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆