Measurement是一个case类。
Here is the generated test case class for our simple example.
下面是我们的简单示例所生成的测试用例类。
We see that UnitsSystem is a sealed case class with no attributes.
我们看到,UnitsSystem是一个密封的case类,没有属性。
Now, let's run the test case class on IE, Firefox and Safari browser.
现在,我们将在IE、Firefox和Safari浏览器上运行测试用例类。
As you can see, lots of things happened with a case class that don't normally happen for a traditional class.
如您所见,伴随case类发生了很多传统类通常不会引发的事情。
Our pattern match then looks for Alice and Bob by inspecting the values passed to the constructor of the Person case class.
然后,我们的模式匹配通过检查传入的Personcase类的值来查找Alice和Bob。
In this case, the exponentiation operator is another form of binary operator so the existing BinaryOp case class serves.
在本例中,求幂运算符是另一种形式的二进制运算符,所以使用现有BinaryOp case类就可以。
This approach makes testing protected methods much easier because the test case class can now extend the class that contains the protected methods.
这种方法使得测试受保护的方法非常容易,因为测试案例类现在可以扩展包含受保护方法的类了。
To change it to produce instances of our case class AST hierarchy (Expr objects), the return type of the combinators has to be changed to be Parser[Expr].
要将它更改为生成case类AST层次结构的实例(Expr对象),组合子的返回类型必须更改为Parser[Expr]。
To change it to produce instances of our case class AST hierarchy (Expr objects), the return type of the combinators has to be changed to be Parser[Expr].
要将它更改为生成case类AST层次结构的实例(Expr对象),组合子的返回类型必须更改为Parser[Expr]。
应用推荐