Testing an assertion that something must not compile

前端 未结 5 957
有刺的猬
有刺的猬 2020-12-04 09:52

The problem

When I\'m working with libraries that support type-level programming, I often find myself writing comments like the following (from an example presente

5条回答
  •  悲&欢浪女
    2020-12-04 10:32

    ScalaTest 2.1.0 has the following syntax for Assertions:

    assertTypeError("val s: String = 1")
    

    And for Matchers:

    "val s: String = 1" shouldNot compile
    

提交回复
热议问题