Skip to content

Commit 93f67d8

Browse files
committed
Add known broken tests for import placement
1 parent 0b74792 commit 93f67d8

23 files changed

+358
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
3+
4+
{-# LANGUAGE TupleSections #-}
5+
import Data.Monoid
6+
7+
8+
9+
10+
class Semigroup a => SomeData a
11+
instance SomeData All
12+
13+
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
14+
15+
addOne :: Int -> Int
16+
addOne x = x + 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
3+
4+
{-# LANGUAGE TupleSections #-}
5+
6+
7+
8+
9+
class Semigroup a => SomeData a
10+
instance SomeData All
11+
12+
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
13+
14+
addOne :: Int -> Int
15+
addOne x = x + 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import Data.Monoid
2+
class Semigroup a => SomeData a
3+
instance SomeData All
4+
5+
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
6+
7+
addOne :: Int -> Int
8+
addOne x = x + 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Semigroup a => SomeData a
2+
instance SomeData All
3+
4+
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
5+
6+
addOne :: Int -> Int
7+
addOne x = x + 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
3+
{-# OPTIONS_GHC -Wall #-}
4+
-- another comment
5+
-- oh
6+
{- multi line
7+
comment
8+
-}
9+
10+
{-# LANGUAGE TupleSections #-}
11+
import Data.Monoid
12+
{- some comment -}
13+
14+
-- again
15+
class Semigroup a => SomeData a
16+
instance SomeData All
17+
18+
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
19+
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
20+
21+
addOne :: Int -> Int
22+
addOne x = x + 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
3+
{-# OPTIONS_GHC -Wall,
4+
OPTIONS_GHC -Wno-unrecognised-pragmas #-}
5+
-- another comment
6+
-- oh
7+
{- multi line
8+
comment
9+
-}
10+
11+
{-# LANGUAGE TupleSections #-}
12+
{- some comment -}
13+
14+
-- again
15+
class Semigroup a => SomeData a
16+
instance SomeData All
17+
18+
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
19+
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
20+
21+
addOne :: Int -> Int
22+
addOne x = x + 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
3+
{-# OPTIONS_GHC -Wall #-}
4+
-- another comment
5+
6+
{-# LANGUAGE TupleSections #-}
7+
import Data.Monoid
8+
{- some comment -}
9+
10+
11+
class Semigroup a => SomeData a
12+
instance SomeData All
13+
14+
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
15+
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
16+
17+
addOne :: Int -> Int
18+
addOne x = x + 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
3+
{-# OPTIONS_GHC -Wall #-}
4+
-- another comment
5+
6+
{-# LANGUAGE TupleSections #-}
7+
{- some comment -}
8+
9+
10+
class Semigroup a => SomeData a
11+
instance SomeData All
12+
13+
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
14+
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
15+
16+
addOne :: Int -> Int
17+
addOne x = x + 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
{-# OPTIONS_GHC -Wall #-}
3+
4+
{-# LANGUAGE TupleSections #-}
5+
module Test
6+
( SomeData(..)
7+
) where
8+
import Data.Text
9+
import Data.Monoid
10+
11+
12+
class Semigroup a => SomeData a
13+
instance SomeData All
14+
15+
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
16+
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
17+
18+
addOne :: Int -> Int
19+
addOne x = x + 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
{-# OPTIONS_GHC -Wall #-}
3+
4+
{-# LANGUAGE TupleSections #-}
5+
module Test
6+
( SomeData(..)
7+
) where
8+
import Data.Text
9+
10+
11+
class Semigroup a => SomeData a
12+
instance SomeData All
13+
14+
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
15+
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
16+
17+
addOne :: Int -> Int
18+
addOne x = x + 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
3+
4+
{-# OPTIONS_GHC -Wall #-}
5+
6+
{-# LANGUAGE TupleSections #-}
7+
module Test
8+
( SomeData(..)
9+
) where
10+
import Data.Monoid
11+
12+
13+
14+
15+
class Semigroup a => SomeData a
16+
instance SomeData All
17+
18+
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
19+
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
20+
21+
addOne :: Int -> Int
22+
addOne x = x + 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
3+
4+
{-# OPTIONS_GHC -Wall #-}
5+
6+
{-# LANGUAGE TupleSections #-}
7+
module Test
8+
( SomeData(..)
9+
) where
10+
11+
12+
13+
14+
class Semigroup a => SomeData a
15+
instance SomeData All
16+
17+
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
18+
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
19+
20+
addOne :: Int -> Int
21+
addOne x = x + 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
import Data.Monoid
3+
4+
class Semigroup a => SomeData a
5+
instance SomeData All
6+
7+
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
8+
9+
f :: Int -> Int
10+
f x = x * x

Diff for: ghcide/test/data/import-placement/ShebangNotAtTop.hs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
3+
class Semigroup a => SomeData a
4+
instance SomeData All
5+
6+
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
7+
8+
f :: Int -> Int
9+
f x = x * x
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import Data.Monoid
2+
class Semigroup a => SomeData a
3+
instance SomeData All
4+
5+
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
6+
7+
f :: Int -> Int
8+
f x = x * x
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Semigroup a => SomeData a
2+
instance SomeData All
3+
4+
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
5+
6+
f :: Int -> Int
7+
f x = x * x
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
3+
4+
{-# OPTIONS_GHC -Wall #-}
5+
6+
7+
8+
{-# LANGUAGE TupleSections #-}
9+
import Data.Monoid
10+
11+
12+
13+
14+
class Semigroup a => SomeData a
15+
instance SomeData All
16+
17+
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
18+
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
19+
20+
addOne :: Int -> Int
21+
addOne x = x + 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
3+
4+
{-# OPTIONS_GHC -Wall #-}
5+
6+
7+
8+
{-# LANGUAGE TupleSections #-}
9+
10+
11+
12+
13+
class Semigroup a => SomeData a
14+
instance SomeData All
15+
16+
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
17+
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
18+
19+
addOne :: Int -> Int
20+
addOne x = x + 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module Asdf
2+
(f
3+
, where')
4+
5+
where
6+
import Data.Int
7+
8+
9+
10+
f :: Int64 -> Int64
11+
f = id'
12+
where id' = id
13+
14+
g :: Int -> Int
15+
g = id
16+
17+
where' :: Int -> Int
18+
where' = id
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module Asdf
2+
(f
3+
, where')
4+
5+
where
6+
7+
8+
9+
f :: Int64 -> Int64
10+
f = id'
11+
where id' = id
12+
13+
g :: Int -> Int
14+
g = id
15+
16+
where' :: Int -> Int
17+
where' = id
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module Asdf
2+
3+
4+
where
5+
import Data.Int
6+
7+
8+
f :: Int64 -> Int64
9+
f = id'
10+
where id' = id
11+
12+
g :: Int -> Int
13+
g = id
14+
15+
where' :: Int -> Int
16+
where' = id
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module Asdf
2+
3+
4+
where
5+
6+
7+
f :: Int64 -> Int64
8+
f = id'
9+
where id' = id
10+
11+
g :: Int -> Int
12+
g = id
13+
14+
where' :: Int -> Int
15+
where' = id

Diff for: ghcide/test/exe/Main.hs

+12-1
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,18 @@ watchedFilesTests = testGroup "watched files"
855855

856856
insertImportTests :: TestTree
857857
insertImportTests = testGroup "insert import"
858-
[ checkImport "above comment at top of module" "CommentAtTop.hs" "CommentAtTop.expected.hs" "import Data.Monoid"
858+
[ (`xfail` "known broken") (checkImport "module where keyword lower in file no exports" "WhereKeywordLowerInFileNoExports.hs" "WhereKeywordLowerInFileNoExports.expected.hs" "import Data.Int")
859+
, (`xfail` "known broken") (checkImport "module where keyword lower in file with exports" "WhereDeclLowerInFile.hs" "WhereDeclLowerInFile.expected.hs" "import Data.Int")
860+
, (`xfail` "known broken") (checkImport "Shebang not at top with spaces" "ShebangNotAtTopWithSpaces.hs" "ShebangNotAtTopWithSpaces.expected.hs" "import Data.Monoid")
861+
, (`xfail` "known broken") (checkImport "Shebang not at top no space" "ShebangNotAtTopNoSpace.hs" "ShebangNotAtTopNoSpace.expected.hs" "import Data.Monoid")
862+
, (`xfail` "known broken") (checkImport "OPTIONS_GHC pragma not at top with spaces" "OptionsNotAtTopWithSpaces.hs" "OptionsNotAtTopWithSpaces.expected.hs" "import Data.Monoid")
863+
, (`xfail` "known broken") (checkImport "Shebang not at top of file" "ShebangNotAtTop.hs" "ShebangNotAtTop.expected.hs" "import Data.Monoid")
864+
, (`xfail` "known broken") (checkImport "OPTIONS_GHC pragma not at top of file" "OptionsPragmaNotAtTop.hs" "OptionsPragmaNotAtTop.expected.hs" "import Data.Monoid")
865+
, (`xfail` "known broken") (checkImport "pragma not at top with comment at top" "PragmaNotAtTopWithCommentsAtTop.hs" "PragmaNotAtTopWithCommentsAtTop.expected.hs" "import Data.Monoid")
866+
, (`xfail` "known broken") (checkImport "pragma not at top multiple comments" "PragmaNotAtTopMultipleComments.hs" "PragmaNotAtTopMultipleComments.expected.hs" "import Data.Monoid")
867+
, checkImport "pragmas not at top with module declaration" "PragmaNotAtTopWithModuleDecl.hs" "PragmaNotAtTopWithModuleDecl.expected.hs" "import Data.Monoid"
868+
, checkImport "pragmas not at top with imports" "PragmaNotAtTopWithImports.hs" "PragmaNotAtTopWithImports.expected.hs" "import Data.Monoid"
869+
, checkImport "above comment at top of module" "CommentAtTop.hs" "CommentAtTop.expected.hs" "import Data.Monoid"
859870
, checkImport "above multiple comments below" "CommentAtTopMultipleComments.hs" "CommentAtTopMultipleComments.expected.hs" "import Data.Monoid"
860871
, checkImport "above curly brace comment" "CommentCurlyBraceAtTop.hs" "CommentCurlyBraceAtTop.expected.hs" "import Data.Monoid"
861872
, checkImport "above multi-line comment" "MultiLineCommentAtTop.hs" "MultiLineCommentAtTop.expected.hs" "import Data.Monoid"

0 commit comments

Comments
 (0)