Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jfmengels committed Jul 19, 2024
1 parent 3c0c0a0 commit a2f2118
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion tests/NoUnused/ExportsTest.elm
Original file line number Diff line number Diff line change
Expand Up @@ -1361,8 +1361,9 @@ tests : Test
tests = Test.describe "thing" B.helper
""", """
module B exposing (helper)
import Basics
{-| @ignore-helper -}
helper = 1
helper = Basics.min
""" ]
|> Review.Test.runOnModules
(defaults
Expand Down
17 changes: 13 additions & 4 deletions tests/NoUnused/VariablesTest.elm
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ b = 2"""
, test "should report unused top-level variables with documentation attached" <|
\() ->
"""module SomeModule exposing (b)
{-| Module documentation -}
{-| Documentation
-}
unusedVar = 1
Expand All @@ -168,13 +169,15 @@ b = 2"""
, under = "unusedVar"
}
|> Review.Test.whenFixed """module SomeModule exposing (b)
{-| Module documentation -}
b = 2"""
]
, test "should report unused top-level variables with documentation attached even if they are annotated" <|
\() ->
"""module SomeModule exposing (b)
{-| Documentation
{-| Module documentation
-}
{-| Function documentation -}
unusedVar : Int
unusedVar = 1
b = 2"""
Expand All @@ -185,8 +188,10 @@ b = 2"""
, details = details
, under = "unusedVar"
}
|> Review.Test.atExactly { start = { row = 5, column = 1 }, end = { row = 5, column = 10 } }
|> Review.Test.atExactly { start = { row = 6, column = 1 }, end = { row = 6, column = 10 } }
|> Review.Test.whenFixed """module SomeModule exposing (b)
{-| Module documentation
-}
b = 2"""
]
, test "should not report unused top-level variables if everything is exposed (functions)" <|
Expand Down Expand Up @@ -2183,7 +2188,8 @@ a = 1"""
, test "should report unused custom type declarations with documentation" <|
\() ->
"""module SomeModule exposing (a)
{-| Documentation -}
{-| Module documentation -}
{-| Function documentation -}
type UnusedType = B | C
a = 1"""
|> Review.Test.run rule
Expand All @@ -2194,6 +2200,7 @@ a = 1"""
, under = "UnusedType"
}
|> Review.Test.whenFixed """module SomeModule exposing (a)
{-| Module documentation -}
a = 1"""
]
, test "should report unused custom type declaration even when it references itself" <|
Expand Down Expand Up @@ -2256,7 +2263,8 @@ a = 1"""
, test "should report unused type aliases declarations with documentation" <|
\() ->
"""module SomeModule exposing (a)
{-| Documentation -}
{-| Module documentation -}
{-| Function documentation -}
type alias UnusedType = { a : B }
a = 1"""
|> Review.Test.run rule
Expand All @@ -2267,6 +2275,7 @@ a = 1"""
, under = "UnusedType"
}
|> Review.Test.whenFixed """module SomeModule exposing (a)
{-| Module documentation -}
a = 1"""
]
, test "should not report type alias used in a signature" <|
Expand Down

0 comments on commit a2f2118

Please sign in to comment.