我正在hspec中为QTextEdit
函数运行Haskell测试。测试如下:
zipWith3
这按预期工作。但是,如果我将main = hspec $ do
... some tests ...
describe "#zipWith3" $ do
it "zipWith but 3-ary" $ do
let f x y z = x + y + z
zipWith3 f [1,2] [4,5,6] [7,8,9] `shouldBe` [12,15]
... other tests ...
绑定更改为let
绑定,就像这样:
where
然后我得到main = hspec $ do
... some tests ...
describe "#zipWith3" $ do
it "zipWith but 3-ary" $ do
zipWith3 f [1,2] [4,5,6] [7,8,9] `shouldBe` [12,15]
where f x y z = x + y + z
... other tests ...
。然后,如果我删除后续测试,则测试通过。因此,有关Chapter7Spec.hs:134:3:error: parse error on input ‘describe’
绑定的内容会干扰后续的where
块。但是我不知道。我很高兴以describe
的方式编写它,但我想知道:为什么let
会产生这种行为?