我从 FsUnit project page 复制了这个示例:
open NUnit.Framework
open FsUnit
let [<Test>] trivial () = 1 |> should not (equal 2)
F# 给我以下错误:
Error 2 This expression was expected to have type bool but here has type Constraints.EqualConstraint
Error 1 The type 'bool' is not compatible with the type 'Constraints.Constraint'
我做错了什么?
最佳答案
较新版本的 FsUnit 包含将 FsUnit.not
函数重命名为 FsUnit.not'
的更改。这应该消除与内置 not
函数的冲突。您可以从 NuGet Gallery 获取最新版本.使用示例可以在 FsUnit GitHub site 上找到。 .
如果您仍然发现问题,请告诉我。我很乐意与您进行更深入的故障排除。
关于f# - FsUnit 示例错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10902363/