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 に答える