Skip to content

Commit bb9c9a0

Browse files
authored
Merge pull request #116 from miniBill/redundant-import
Add test for redundant modules in imports
2 parents a28bf9a + 524a922 commit bb9c9a0

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

tests/RedundantQualification.elm

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
module RedundantQualification exposing (suite)
2+
3+
import Elm
4+
import Elm.Annotation
5+
import Elm.Arg
6+
import Elm.Expect
7+
import Test exposing (Test, describe, test)
8+
9+
10+
suite : Test
11+
suite =
12+
describe "Avoid redundant imports"
13+
[ inTypeAliases
14+
, inAnnotation
15+
]
16+
17+
18+
inTypeAliases : Test
19+
inTypeAliases =
20+
test "In type aliases" <|
21+
\_ ->
22+
Elm.file [ "Foo" ]
23+
[ Elm.alias "Bar" (Elm.Annotation.named [ "Foo" ] "Baz") ]
24+
|> Elm.Expect.fileContentAs
25+
"""
26+
module Foo exposing (..)
27+
28+
29+
type alias Bar =
30+
Baz
31+
"""
32+
33+
34+
inAnnotation : Test
35+
inAnnotation =
36+
test "In annotation" <|
37+
\_ ->
38+
Elm.file [ "Foo" ]
39+
[ Elm.fn
40+
(Elm.Arg.varWith "v" (Elm.Annotation.named [ "Foo" ] "Baz"))
41+
identity
42+
|> Elm.declaration "id"
43+
]
44+
|> Elm.Expect.fileContentAs
45+
"""
46+
module Foo exposing (..)
47+
48+
49+
id : Baz -> Baz
50+
id v =
51+
v
52+
"""

0 commit comments

Comments
 (0)