packages feed

hspec-core 2.1.2 → 2.1.3

raw patch · 3 files changed

+13/−7 lines, 3 files

Files

hspec-core.cabal view
@@ -1,5 +1,5 @@ name:             hspec-core-version:          2.1.2+version:          2.1.3 license:          MIT license-file:     LICENSE copyright:        (c) 2011-2014 Simon Hengel,
src/Test/Hspec/Core/Formatters.hs view
@@ -181,17 +181,16 @@      formatFailure :: (Int, FailureRecord) -> FormatM ()     formatFailure (n, FailureRecord mLoc path reason) = do+      forM_ mLoc $ \loc -> do+        withInfoColor $ writeLine (formatLoc loc)       write ("  " ++ show n ++ ") ")       writeLine (formatRequirement path)       withFailColor $ do         forM_ (lines err) $ \x -> do           writeLine ("       " ++ x)-      forM_ mLoc $ \loc -> do-        writeLine ""-        withInfoColor $ writeLine (formatLoc loc)       where         err = either (("uncaught exception: " ++) . formatException) id reason-        formatLoc (Location file line _column accuracy) = "     # " ++ file ++ ":" ++ show line ++ bestEffortMarking+        formatLoc (Location file line _column accuracy) = "  " ++ file ++ ":" ++ show line ++ ":" ++ bestEffortMarking           where             bestEffortMarking = case accuracy of               ExactLocation -> ""
test/Test/Hspec/Core/FormattersSpec.hs view
@@ -162,13 +162,20 @@     context "when a failed example has a source location" $ do       let bestEffortExplanation = "Source locations marked with \"best-effort\" are calculated heuristically and may be incorrect." +      it "includes the source locations above the error messages" $ do+        let loc = H.Location "test/FooSpec.hs" 23 0 H.ExactLocation+            addLoc e = e {H.itemLocation = Just loc}+        r <- runSpec $ H.mapSpecItem_ addLoc $ do+          H.it "foo" False+        r `shouldContain` ["  test/FooSpec.hs:23:", "  1) foo"]+       context "when source location is exact" $ do         it "includes that source locations" $ do           let loc = H.Location "test/FooSpec.hs" 23 0 H.ExactLocation               addLoc e = e {H.itemLocation = Just loc}           r <- runSpec $ H.mapSpecItem_ addLoc $ do             H.it "foo" False-          r `shouldSatisfy` any (== "     # test/FooSpec.hs:23")+          r `shouldSatisfy` any (== "  test/FooSpec.hs:23:")          it "does not include 'best-effort' explanation" $ do           let loc = H.Location "test/FooSpec.hs" 23 0 H.ExactLocation@@ -183,7 +190,7 @@               addLoc e = e {H.itemLocation = Just loc}           r <- runSpec $ H.mapSpecItem_ addLoc $ do             H.it "foo" False-          r `shouldSatisfy` any (== "     # test/FooSpec.hs:23 (best-effort)")+          r `shouldSatisfy` any (== "  test/FooSpec.hs:23: (best-effort)")          it "includes 'best-effort' explanation" $ do           let loc = H.Location "test/FooSpec.hs" 23 0 H.BestEffort