3

我是 Yesod 的新手,我正在尝试在一个withApp块中添加一个待处理的规范(目前我只是想修改由 Yesod 脚手架生成的规范)。

代码如下:

appSpec :: Spec appSpec :: withApp $ do describe "getMyHandlerR" $ do it "todo" $ do pending

但我收到以下错误消息:

Couldn't match type ‘(App, wai-3.2.0:Network.Wai.Middleware)’
               with ‘()’
Expected type: SpecWith (TestApp App)
  Actual type: SpecWith (Arg Expectation)
In a stmt of a 'do' block: it "todo" $ do { pending }
In the second argument of ‘($)’, namely
  ‘do { it "todo" $ do { pending } }’
In a stmt of a 'do' block:
  describe "upload a file without error"
  $ do { it "todo" $ do { pending } }

如果我删除withApp一切正常。我知道withApp以某种方式改变了预期的类型,但是为什么会有正确的类型而describe没有呢?itpending

4

2 回答 2

3

将我的评论复制到答案:

我认为您只需要通过以下方式丢弃TestApp App论点:

it "todo" $ \_ -> pending

或者

it "todo" $ const pending

ypending添加一个或等效项不值得吗?

对我来说听起来是个好主意,实际上我从未亲自使用过pending,这就是为什么我从未想过它。你能发送一个 PR 来包含它吗?

于 2016-04-12T05:36:24.307 回答
1

这对我来说就像最新的 Yesod 的魅力:

it "should x" $ do
  liftIO pending
于 2017-03-24T00:25:26.227 回答