Skip to content

Commit

Permalink
Add known broken tests for import placement
Browse files Browse the repository at this point in the history
  • Loading branch information
nini-faroux committed Dec 1, 2021
1 parent 0b74792 commit 3762375
Show file tree
Hide file tree
Showing 25 changed files with 395 additions and 1 deletion.
13 changes: 13 additions & 0 deletions ghcide/test/data/import-placement/MultiLinePragma.expected.hs
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Semigroup a => SomeData a
instance SomeData All

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

addOne :: Int -> Int
addOne x = x + 1
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 3762375

Please sign in to comment.