Skip to content

Commit

Permalink
Add known broken tests for import placement (#2425)
Browse files Browse the repository at this point in the history
Co-authored-by: Javier Neira <atreyu.bbb@gmail.com>
  • Loading branch information
nini-faroux and jneira committed Dec 2, 2021
1 parent 711e19c commit 2e59c60
Show file tree
Hide file tree
Showing 25 changed files with 569 additions and 22 deletions.
13 changes: 13 additions & 0 deletions ghcide/test/data/import-placement/MultiLinePragma.expected.hs
@@ -0,0 +1,13 @@
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards,
OverloadedStrings #-}
{-# OPTIONS_GHC -Wall,
-Wno-unused-imports #-}
import Data.Monoid


-- some comment
class Semigroup a => SomeData a

instance SomeData All
12 changes: 12 additions & 0 deletions ghcide/test/data/import-placement/MultiLinePragma.hs
@@ -0,0 +1,12 @@
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards,
OverloadedStrings #-}
{-# OPTIONS_GHC -Wall,
-Wno-unused-imports #-}


-- some comment
class Semigroup a => SomeData a

instance SomeData All
@@ -0,0 +1,16 @@
{-# LANGUAGE OverloadedStrings #-}


{-# LANGUAGE TupleSections #-}
import Data.Monoid




class Semigroup a => SomeData a
instance SomeData All

{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
15 changes: 15 additions & 0 deletions ghcide/test/data/import-placement/OptionsNotAtTopWithSpaces.hs
@@ -0,0 +1,15 @@
{-# LANGUAGE OverloadedStrings #-}


{-# LANGUAGE TupleSections #-}




class Semigroup a => SomeData a
instance SomeData All

{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
@@ -0,0 +1,8 @@
import Data.Monoid
class Semigroup a => SomeData a
instance SomeData All

{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
7 changes: 7 additions & 0 deletions ghcide/test/data/import-placement/OptionsPragmaNotAtTop.hs
@@ -0,0 +1,7 @@
class Semigroup a => SomeData a
instance SomeData All

{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
@@ -0,0 +1,23 @@
{-# LANGUAGE OverloadedStrings #-}

{-# OPTIONS_GHC -Wall,
OPTIONS_GHC -Wno-unrecognised-pragmas #-}
-- another comment
-- oh
{- multi line
comment
-}

{-# LANGUAGE TupleSections #-}
import Data.Monoid
{- some comment -}

-- again
class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
@@ -0,0 +1,22 @@
{-# LANGUAGE OverloadedStrings #-}

{-# OPTIONS_GHC -Wall,
OPTIONS_GHC -Wno-unrecognised-pragmas #-}
-- another comment
-- oh
{- multi line
comment
-}

{-# LANGUAGE TupleSections #-}
{- some comment -}

-- again
class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
@@ -0,0 +1,18 @@
{-# LANGUAGE OverloadedStrings #-}

{-# OPTIONS_GHC -Wall #-}
-- another comment

{-# LANGUAGE TupleSections #-}
import Data.Monoid
{- some comment -}


class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
@@ -0,0 +1,17 @@
{-# LANGUAGE OverloadedStrings #-}

{-# OPTIONS_GHC -Wall #-}
-- another comment

{-# LANGUAGE TupleSections #-}
{- some comment -}


class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
@@ -0,0 +1,19 @@
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -Wall #-}

{-# LANGUAGE TupleSections #-}
module Test
( SomeData(..)
) where
import Data.Text
import Data.Monoid


class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
18 changes: 18 additions & 0 deletions ghcide/test/data/import-placement/PragmaNotAtTopWithImports.hs
@@ -0,0 +1,18 @@
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -Wall #-}

{-# LANGUAGE TupleSections #-}
module Test
( SomeData(..)
) where
import Data.Text


class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
@@ -0,0 +1,22 @@
{-# LANGUAGE OverloadedStrings #-}


{-# OPTIONS_GHC -Wall #-}

{-# LANGUAGE TupleSections #-}
module Test
( SomeData(..)
) where
import Data.Monoid




class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
21 changes: 21 additions & 0 deletions ghcide/test/data/import-placement/PragmaNotAtTopWithModuleDecl.hs
@@ -0,0 +1,21 @@
{-# LANGUAGE OverloadedStrings #-}


{-# OPTIONS_GHC -Wall #-}

{-# LANGUAGE TupleSections #-}
module Test
( SomeData(..)
) where




class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
10 changes: 10 additions & 0 deletions ghcide/test/data/import-placement/ShebangNotAtTop.expected.hs
@@ -0,0 +1,10 @@
{-# LANGUAGE OverloadedStrings #-}
import Data.Monoid

class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"

f :: Int -> Int
f x = x * x
9 changes: 9 additions & 0 deletions ghcide/test/data/import-placement/ShebangNotAtTop.hs
@@ -0,0 +1,9 @@
{-# LANGUAGE OverloadedStrings #-}

class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"

f :: Int -> Int
f x = x * x
@@ -0,0 +1,8 @@
import Data.Monoid
class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"

f :: Int -> Int
f x = x * x
7 changes: 7 additions & 0 deletions ghcide/test/data/import-placement/ShebangNotAtTopNoSpace.hs
@@ -0,0 +1,7 @@
class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"

f :: Int -> Int
f x = x * x
@@ -0,0 +1,21 @@
{-# LANGUAGE OverloadedStrings #-}


{-# OPTIONS_GHC -Wall #-}



{-# LANGUAGE TupleSections #-}
import Data.Monoid




class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
20 changes: 20 additions & 0 deletions ghcide/test/data/import-placement/ShebangNotAtTopWithSpaces.hs
@@ -0,0 +1,20 @@
{-# LANGUAGE OverloadedStrings #-}


{-# OPTIONS_GHC -Wall #-}



{-# LANGUAGE TupleSections #-}




class Semigroup a => SomeData a
instance SomeData All

#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

addOne :: Int -> Int
addOne x = x + 1
18 changes: 18 additions & 0 deletions ghcide/test/data/import-placement/WhereDeclLowerInFile.expected.hs
@@ -0,0 +1,18 @@
module Asdf
(f
, where')

where
import Data.Int



f :: Int64 -> Int64
f = id'
where id' = id

g :: Int -> Int
g = id

where' :: Int -> Int
where' = id
17 changes: 17 additions & 0 deletions ghcide/test/data/import-placement/WhereDeclLowerInFile.hs
@@ -0,0 +1,17 @@
module Asdf
(f
, where')

where



f :: Int64 -> Int64
f = id'
where id' = id

g :: Int -> Int
g = id

where' :: Int -> Int
where' = id
@@ -0,0 +1,16 @@
module Asdf


where
import Data.Int


f :: Int64 -> Int64
f = id'
where id' = id

g :: Int -> Int
g = id

where' :: Int -> Int
where' = id
@@ -0,0 +1,15 @@
module Asdf


where


f :: Int64 -> Int64
f = id'
where id' = id

g :: Int -> Int
g = id

where' :: Int -> Int
where' = id

0 comments on commit 2e59c60

Please sign in to comment.