-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
- Loading branch information
1 parent
9584b3e
commit f6a94ff
Showing
6 changed files
with
71 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,3 +88,4 @@ tests: | |
- tasty | ||
- tasty-hspec | ||
- tasty-quickcheck | ||
- time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-- | The pretty tests | ||
-- | ||
-- @since 0.1.0 | ||
module PrettySpec ( prettySpec ) where | ||
|
||
import Data.Time.Clock ( getCurrentTime ) | ||
|
||
import Model ( Benchmark(Benchmark), Test(Test) ) | ||
|
||
import Pretty ( header, prettyPrint ) | ||
|
||
import Test.Tasty.Hspec ( Spec, it, parallel, shouldContain ) | ||
|
||
-- Pretty.hs related unit tests | ||
prettySpec :: Spec | ||
prettySpec = parallel $ do | ||
it "should succeed pretty print without previous result" $ do | ||
let bs = [ Benchmark 0 0 "name" 1 "s" ] | ||
res = prettyPrint bs Nothing | ||
res `shouldContain` "Nothing to compare against" | ||
res `shouldContain` header | ||
res `shouldContain` "name" | ||
res `shouldContain` "=\n```" | ||
|
||
it "should succeed pretty print with previous result" $ do | ||
x <- getCurrentTime | ||
let t = Test x "" "" "" "" [] | ||
b1 = Benchmark 0 0 "name1" 1 "s" | ||
b2 = Benchmark 1 2 "this is a very very long benchmark name" 2 "s" | ||
res = prettyPrint [ b1, b2 ] $ Just (t, [ b1 ]) | ||
res `shouldContain` "Comparing to commit" | ||
res `shouldContain` header | ||
res `shouldContain` "name" | ||
res `shouldContain` "…" | ||
res `shouldContain` "=\n```" | ||
|