Skip to content

Commit da6b074

Browse files
committed
Rename test files
1 parent 558cd9d commit da6b074

29 files changed

+86
-58
lines changed

plugins/hls-class-plugin/test/Main.hs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ tests recorder = testGroup
3636
"class"
3737
[codeActionTests recorder , codeLensTests recorder]
3838

39-
-- codeActionTests :: TestTree
39+
codeActionTests :: Recorder (WithPriority Class.Log) -> TestTree
4040
codeActionTests recorder = testGroup
4141
"code actions"
4242
[ testCase "Produces addMinimalMethodPlaceholders code actions for one instance" $ do
@@ -70,22 +70,22 @@ codeActionTests recorder = testGroup
7070
, goldenWithClass recorder "Creates a placeholder for other two methods" "T6" "2" $ \(_:_:ghAction:_) -> do
7171
executeCodeAction ghAction
7272
, onlyRunForGhcVersions [GHC92] "Only ghc-9.2 enabled GHC2021 implicitly" $
73-
goldenWithClass recorder "Don't insert pragma with GHC2021" "T16" "" $ \(_:eqWithSig:_) -> do
73+
goldenWithClass recorder "Don't insert pragma with GHC2021" "InsertWithGHC2021Enabled" "" $ \(_:eqWithSig:_) -> do
7474
executeCodeAction eqWithSig
75-
, goldenWithClass recorder "Insert pragma if not exist" "T7" "" $ \(_:eqWithSig:_) -> do
75+
, goldenWithClass recorder "Insert pragma if not exist" "InsertWithoutPragma" "" $ \(_:eqWithSig:_) -> do
7676
executeCodeAction eqWithSig
77-
, goldenWithClass recorder "Don't insert pragma if exist" "T8" "" $ \(_:eqWithSig:_) -> do
77+
, goldenWithClass recorder "Don't insert pragma if exist" "InsertWithPragma" "" $ \(_:eqWithSig:_) -> do
7878
executeCodeAction eqWithSig
79-
, goldenWithClass recorder "Only insert pragma once" "T9" "" $ \(_:multi:_) -> do
79+
, goldenWithClass recorder "Only insert pragma once" "InsertPragmaOnce" "" $ \(_:multi:_) -> do
8080
executeCodeAction multi
8181
]
8282

83-
-- codeLensTests :: TestTree
83+
codeLensTests :: Recorder (WithPriority Class.Log) -> TestTree
8484
codeLensTests recorder = testGroup
8585
"code lens"
8686
[ testCase "Has code lens" $ do
8787
runSessionWithServer (classPlugin recorder) testDataDir $ do
88-
doc <- openDoc "T10.hs" "haskell"
88+
doc <- openDoc "CodeLensSimple.hs" "haskell"
8989
lens <- getCodeLenses doc
9090
let titles = map (^. J.title) $ mapMaybe (^. J.command) lens
9191
liftIO $ titles @?=
@@ -97,25 +97,27 @@ codeLensTests recorder = testGroup
9797
sendConfigurationChanged
9898
$ toJSON
9999
$ def { Plugin.plugins = [("class", def { plcConfig = "typelensOn" .= False })] }
100-
doc <- openDoc "T10.hs" "haskell"
100+
doc <- openDoc "CodeLensSimple.hs" "haskell"
101101
lens <- getCodeLenses doc
102102
let titles = map (^. J.title) $ mapMaybe (^. J.command) lens
103103
liftIO $ titles @?= []
104-
, goldenCodeLens recorder "Apply code lens" "T10" 1
105-
, goldenCodeLens recorder "Apply code lens for local class" "T11" 0
106-
, goldenCodeLens recorder "Apply code lens on the same line" "T12" 0
107-
, goldenCodeLens recorder "Don't insert pragma while existing" "T13" 0
104+
, goldenCodeLens recorder "Apply code lens" "CodeLensSimple" 1
105+
, goldenCodeLens recorder "Apply code lens for local class" "LocalClassDefine" 0
106+
, goldenCodeLens recorder "Apply code lens on the same line" "Inline" 0
107+
, goldenCodeLens recorder "Don't insert pragma while existing" "CodeLensWithPragma" 0
108108
, onlyRunForGhcVersions [GHC92] "Only ghc-9.2 enabled GHC2021 implicitly" $
109-
goldenCodeLens recorder "Don't insert pragma while GHC2021 enabled" "T14" 0
110-
, goldenCodeLens recorder "Qualified name" "T15" 0
109+
goldenCodeLens recorder "Don't insert pragma while GHC2021 enabled" "CodeLensWithGHC2021" 0
110+
, goldenCodeLens recorder "Qualified name" "Qualified" 0
111+
, goldenCodeLens recorder "Type family" "TypeFamily" 0
111112
]
112113

113114
_CACodeAction :: Prism' (Command |? CodeAction) CodeAction
114115
_CACodeAction = prism' InR $ \case
115116
InR action -> Just action
116117
_ -> Nothing
117118

118-
-- goldenCodeLens :: TestName -> FilePath -> Int -> TestTree
119+
120+
goldenCodeLens :: Recorder (WithPriority Class.Log) -> TestName -> FilePath -> Int -> TestTree
119121
goldenCodeLens recorder title path idx =
120122
goldenWithHaskellDoc (classPlugin recorder) title testDataDir path "expected" "hs" $ \doc -> do
121123
lens <- getCodeLenses doc

plugins/hls-class-plugin/test/testdata/T10.expected.hs renamed to plugins/hls-class-plugin/test/testdata/CodeLensSimple.expected.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{-# LANGUAGE InstanceSigs #-}
2-
module T10 where
2+
module CodeLensSimple where
33

44
data A
55
instance Eq A where

plugins/hls-class-plugin/test/testdata/T10.hs renamed to plugins/hls-class-plugin/test/testdata/CodeLensSimple.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module T10 where
1+
module CodeLensSimple where
22

33
data A
44
instance Eq A where

plugins/hls-class-plugin/test/testdata/T14.expected.hs renamed to plugins/hls-class-plugin/test/testdata/CodeLensWithGHC2021.expected.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{-# LANGUAGE GHC2021 #-}
2-
module T14 where
2+
module CodeLensWithGHC2021 where
33

44
data A
55
instance Eq A where

plugins/hls-class-plugin/test/testdata/T14.hs renamed to plugins/hls-class-plugin/test/testdata/CodeLensWithGHC2021.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{-# LANGUAGE GHC2021 #-}
2-
module T14 where
2+
module CodeLensWithGHC2021 where
33

44
data A
55
instance Eq A where

plugins/hls-class-plugin/test/testdata/T13.expected.hs renamed to plugins/hls-class-plugin/test/testdata/CodeLensWithPragma.expected.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{-# LANGUAGE InstanceSigs #-}
2-
module T13 where
2+
module CodeLensWithPragma where
33

44
data A
55
instance Eq A where

plugins/hls-class-plugin/test/testdata/T13.hs renamed to plugins/hls-class-plugin/test/testdata/CodeLensWithPragma.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{-# LANGUAGE InstanceSigs #-}
2-
module T13 where
2+
module CodeLensWithPragma where
33

44
data A
55
instance Eq A where
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{-# LANGUAGE InstanceSigs #-}
2+
module Inline where
3+
4+
data A
5+
instance Eq A where (==) :: A -> A -> Bool
6+
(==) = _
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module T12 where
1+
module Inline where
22

33
data A
44
instance Eq A where (==) = _

plugins/hls-class-plugin/test/testdata/T9.expected.hs renamed to plugins/hls-class-plugin/test/testdata/InsertPragmaOnce.expected.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{-# LANGUAGE InstanceSigs #-}
2-
module T9 where
2+
module InsertPragmaOnce where
33

44
data A aaa
55
instance Applicative A where
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module T9 where
1+
module InsertPragmaOnce where
22

33
data A aaa
44
instance Applicative A

plugins/hls-class-plugin/test/testdata/T12.expected.hs renamed to plugins/hls-class-plugin/test/testdata/InsertWithGHC2021Enabled.expected.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{-# LANGUAGE InstanceSigs #-}
2-
module T12 where
1+
{-# LANGUAGE GHC2021#-}
2+
module InsertWithGHC2021Enabled where
33

44
data A
55
instance Eq A where
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{-# LANGUAGE GHC2021#-}
2-
module T16 where
2+
module InsertWithGHC2021Enabled where
33

44
data A
55
instance Eq A

plugins/hls-class-plugin/test/testdata/T7.expected.hs renamed to plugins/hls-class-plugin/test/testdata/InsertWithPragma.expected.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{-# LANGUAGE InstanceSigs #-}
2-
module T7 where
2+
module InsertWithPragma where
33

44
data A
55
instance Eq A where
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{-# LANGUAGE InstanceSigs #-}
2-
module T8 where
2+
module InsertWithPragma where
33

44
data A
55
instance Eq A

plugins/hls-class-plugin/test/testdata/T8.expected.hs renamed to plugins/hls-class-plugin/test/testdata/InsertWithoutPragma.expected.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{-# LANGUAGE InstanceSigs #-}
2-
module T8 where
2+
module InsertWithoutPragma where
33

44
data A
55
instance Eq A where
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module InsertWithoutPragma where
2+
3+
data A
4+
instance Eq A

plugins/hls-class-plugin/test/testdata/T11.expected.hs renamed to plugins/hls-class-plugin/test/testdata/LocalClassDefine.expected.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{-# LANGUAGE InstanceSigs #-}
2-
module T11 where
2+
module LocalClassDefine where
33

44
data A
55
class F a where

plugins/hls-class-plugin/test/testdata/T11.hs renamed to plugins/hls-class-plugin/test/testdata/LocalClassDefine.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module T11 where
1+
module LocalClassDefine where
22

33
data A
44
class F a where
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{-# LANGUAGE InstanceSigs #-}
2+
module Qualified where
3+
import qualified QualifiedA
4+
5+
class F a where
6+
f :: a
7+
8+
instance F QualifiedA.A where
9+
f :: QualifiedA.A
10+
f = undefined
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module Qualified where
2+
import qualified QualifiedA
3+
4+
class F a where
5+
f :: a
6+
7+
instance F QualifiedA.A where
8+
f = undefined
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module QualifiedA where
2+
3+
data A

plugins/hls-class-plugin/test/testdata/T15.expected.hs

Lines changed: 0 additions & 10 deletions
This file was deleted.

plugins/hls-class-plugin/test/testdata/T15.hs

Lines changed: 0 additions & 8 deletions
This file was deleted.

plugins/hls-class-plugin/test/testdata/T15A.hs

Lines changed: 0 additions & 3 deletions
This file was deleted.

plugins/hls-class-plugin/test/testdata/T7.hs

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{-# LANGUAGE TypeFamilies #-}
2+
{-# LANGUAGE InstanceSigs #-}
3+
module TypeFamily where
4+
5+
class F a where
6+
type Elem a
7+
f :: Elem a -> a
8+
9+
instance Eq a => F [a] where
10+
f :: Eq a => Elem [a] -> [a]
11+
f = _
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{-# LANGUAGE TypeFamilies #-}
2+
module TypeFamily where
3+
4+
class F a where
5+
type Elem a
6+
f :: Elem a -> a
7+
8+
instance Eq a => F [a] where
9+
f = _
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
cradle:
22
direct:
3-
arguments: [-XHaskell2010, T15A]
3+
arguments: [-XHaskell2010, QualifiedA]

0 commit comments

Comments
 (0)