Skip to content

Commit 2c0834e

Browse files
authored
Tests: Improve tests titles (kowainik#141)
* Test: Improve tests titles Add a make command to run all tests * Typo * Remove redunant do * Remove unnecessary test run
1 parent 22f7ac5 commit 2c0834e

File tree

4 files changed

+21
-15
lines changed

4 files changed

+21
-15
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@ test-chapter4:
4545
test-chapter4-basic:
4646
cabal test doctest-chapter4 --enable-tests --test-show-details=direct
4747
cabal run learn4haskell-test --enable-tests -- -m "Chapter4Normal"
48+
49+
.PHONY: test-all
50+
test-all:
51+
cabal test all --enable-tests --test-show-details=direct

test/Test/Chapter1.hs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,13 @@ chapter1normal = describe "Chapter1Normal" $ do
7070
(firstDigit x :: Int) === (lastDigit (reverseInt x) :: Int)
7171

7272
chapter1advanced :: Spec
73-
chapter1advanced = describe "Chapter1Advanced" $ do
74-
it "first digit 0" $ firstDigit 0 `shouldBe` 0
75-
it "first digit 0 < 10" $ firstDigit 9 `shouldBe` 9
76-
it "first digit 10 < 100" $ firstDigit 58 `shouldBe` 5
77-
it "first digit 100 < 1000" $ firstDigit 158 `shouldBe` 1
78-
it "first digit big" $ firstDigit 467321 `shouldBe` 4
79-
it "first digit 0 > -10" $ firstDigit (-9) `shouldBe` 9
80-
it "first digit -10 > -100" $ firstDigit (-58) `shouldBe` 5
81-
it "first digit -100 > -1000" $ firstDigit (-158) `shouldBe` 1
73+
chapter1advanced = describe "Chapter1Advanced" $
74+
describe "Task 10*" $ do
75+
it "first digit 0" $ firstDigit 0 `shouldBe` 0
76+
it "first digit 0 < 10" $ firstDigit 9 `shouldBe` 9
77+
it "first digit 10 < 100" $ firstDigit 58 `shouldBe` 5
78+
it "first digit 100 < 1000" $ firstDigit 158 `shouldBe` 1
79+
it "first digit big" $ firstDigit 467321 `shouldBe` 4
80+
it "first digit 0 > -10" $ firstDigit (-9) `shouldBe` 9
81+
it "first digit -10 > -100" $ firstDigit (-58) `shouldBe` 5
82+
it "first digit -100 > -1000" $ firstDigit (-158) `shouldBe` 1

test/Test/Chapter2.hs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@ chapter2normal = describe "Chapter2Normal" $ do
6969
it "empty on negative" $ rotate (-5) [1..5] `shouldBe` emptyInts
7070

7171
chapter2advanced :: Spec
72-
chapter2advanced = describe "Chapter2Advanced" $ describe "Task12*: rewind" $ do
73-
it "empty" $ rewind emptyInts `shouldBe` emptyInts
74-
it "one elem" $ rewind [1] `shouldBe` [1]
75-
it "many elems" $ rewind [1..10] `shouldBe` [10,9..1]
76-
it "many elems random" $ rewind [5,1,9,56,32,7,11] `shouldBe` [11,7,32,56,9,1,5]
72+
chapter2advanced = describe "Chapter2Advanced" $
73+
describe "Task12*: rewind" $ do
74+
it "empty" $ rewind emptyInts `shouldBe` emptyInts
75+
it "one elem" $ rewind [1] `shouldBe` [1]
76+
it "many elems" $ rewind [1..10] `shouldBe` [10,9..1]
77+
it "many elems random" $ rewind [5,1,9,56,32,7,11] `shouldBe` [11,7,32,56,9,1,5]
7778

7879
emptyInts :: [Int]
7980
emptyInts = []

test/Test/Chapter4.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ chapter4normal = describe "Chapter4Normal" $ do
5252

5353
chapter4advanced :: Spec
5454
chapter4advanced = describe "Chapter4Advanced" $
55-
describe "andM" $ do
55+
describe "Task 8*: Before the Final Boss" $ do
5656
it "Nothing - Nothing" $ andM Nothing Nothing `shouldBe` Nothing
5757
it "Nothing - Just" $ andM Nothing (Just True) `shouldBe` Nothing
5858
it "Just True - Nothing" $ andM (Just True) Nothing `shouldBe` Nothing

0 commit comments

Comments
 (0)