Skip to content

Instantly share code, notes, and snippets.

@danpolanco
Created March 9, 2016 04:37
Show Gist options
  • Save danpolanco/cf7873b2288b6782d11b to your computer and use it in GitHub Desktop.
Save danpolanco/cf7873b2288b6782d11b to your computer and use it in GitHub Desktop.
I don't understand how to test for Maybe yet.....
let validScorecard = Align.Scorecard {Align.match = 1, Align.mismatch = -1, Align.gap = 0}
let stalemateScorecard = Align.Scorecard {Align.match = 0, Align.mismatch = 0, Align.gap = 0}
describe "Align.validateScorecard" $ do
context "with a valid scorecard" $ do
it "returns Just the scoredcard" $ do
Align.validateScorecard validScorecard `shouldBe` Just validScorecard
context "with a scorecard that would lead to a stalemate" $ do
it "returns Nothing" $ do
Align.validateScorecard stalemateScorecard `shouldBe` (Nothing :: Maybe Align.Scorecard)
@erikd
Copy link

erikd commented Mar 9, 2016

I saw this in #hspec on Freenode.

The above seems fine. What's the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment