From 3762375f2735ca74fef635f8396732675ce1ecf8 Mon Sep 17 00:00:00 2001 From: nini-faroux Date: Wed, 1 Dec 2021 12:49:34 +0000 Subject: [PATCH] Add known broken tests for import placement --- .../MultiLinePragma.expected.hs | 13 ++++++++++ .../data/import-placement/MultiLinePragma.hs | 12 ++++++++++ .../OptionsNotAtTopWithSpaces.expected.hs | 16 +++++++++++++ .../OptionsNotAtTopWithSpaces.hs | 15 ++++++++++++ .../OptionsPragmaNotAtTop.expected.hs | 8 +++++++ .../import-placement/OptionsPragmaNotAtTop.hs | 7 ++++++ ...PragmaNotAtTopMultipleComments.expected.hs | 23 ++++++++++++++++++ .../PragmaNotAtTopMultipleComments.hs | 22 +++++++++++++++++ ...ragmaNotAtTopWithCommentsAtTop.expected.hs | 18 ++++++++++++++ .../PragmaNotAtTopWithCommentsAtTop.hs | 17 +++++++++++++ .../PragmaNotAtTopWithImports.expected.hs | 19 +++++++++++++++ .../PragmaNotAtTopWithImports.hs | 18 ++++++++++++++ .../PragmaNotAtTopWithModuleDecl.expected.hs | 22 +++++++++++++++++ .../PragmaNotAtTopWithModuleDecl.hs | 21 ++++++++++++++++ .../ShebangNotAtTop.expected.hs | 10 ++++++++ .../data/import-placement/ShebangNotAtTop.hs | 9 +++++++ .../ShebangNotAtTopNoSpace.expected.hs | 8 +++++++ .../ShebangNotAtTopNoSpace.hs | 7 ++++++ .../ShebangNotAtTopWithSpaces.expected.hs | 21 ++++++++++++++++ .../ShebangNotAtTopWithSpaces.hs | 20 ++++++++++++++++ .../WhereDeclLowerInFile.expected.hs | 18 ++++++++++++++ .../import-placement/WhereDeclLowerInFile.hs | 17 +++++++++++++ ...ereKeywordLowerInFileNoExports.expected.hs | 16 +++++++++++++ .../WhereKeywordLowerInFileNoExports.hs | 15 ++++++++++++ ghcide/test/exe/Main.hs | 24 ++++++++++++++++++- 25 files changed, 395 insertions(+), 1 deletion(-) create mode 100644 ghcide/test/data/import-placement/MultiLinePragma.expected.hs create mode 100644 ghcide/test/data/import-placement/MultiLinePragma.hs create mode 100644 ghcide/test/data/import-placement/OptionsNotAtTopWithSpaces.expected.hs create mode 100644 ghcide/test/data/import-placement/OptionsNotAtTopWithSpaces.hs create mode 100644 ghcide/test/data/import-placement/OptionsPragmaNotAtTop.expected.hs create mode 100644 ghcide/test/data/import-placement/OptionsPragmaNotAtTop.hs create mode 100644 ghcide/test/data/import-placement/PragmaNotAtTopMultipleComments.expected.hs create mode 100644 ghcide/test/data/import-placement/PragmaNotAtTopMultipleComments.hs create mode 100644 ghcide/test/data/import-placement/PragmaNotAtTopWithCommentsAtTop.expected.hs create mode 100644 ghcide/test/data/import-placement/PragmaNotAtTopWithCommentsAtTop.hs create mode 100644 ghcide/test/data/import-placement/PragmaNotAtTopWithImports.expected.hs create mode 100644 ghcide/test/data/import-placement/PragmaNotAtTopWithImports.hs create mode 100644 ghcide/test/data/import-placement/PragmaNotAtTopWithModuleDecl.expected.hs create mode 100644 ghcide/test/data/import-placement/PragmaNotAtTopWithModuleDecl.hs create mode 100644 ghcide/test/data/import-placement/ShebangNotAtTop.expected.hs create mode 100644 ghcide/test/data/import-placement/ShebangNotAtTop.hs create mode 100644 ghcide/test/data/import-placement/ShebangNotAtTopNoSpace.expected.hs create mode 100644 ghcide/test/data/import-placement/ShebangNotAtTopNoSpace.hs create mode 100644 ghcide/test/data/import-placement/ShebangNotAtTopWithSpaces.expected.hs create mode 100644 ghcide/test/data/import-placement/ShebangNotAtTopWithSpaces.hs create mode 100644 ghcide/test/data/import-placement/WhereDeclLowerInFile.expected.hs create mode 100644 ghcide/test/data/import-placement/WhereDeclLowerInFile.hs create mode 100644 ghcide/test/data/import-placement/WhereKeywordLowerInFileNoExports.expected.hs create mode 100644 ghcide/test/data/import-placement/WhereKeywordLowerInFileNoExports.hs diff --git a/ghcide/test/data/import-placement/MultiLinePragma.expected.hs b/ghcide/test/data/import-placement/MultiLinePragma.expected.hs new file mode 100644 index 00000000000..ca0b9f28dca --- /dev/null +++ b/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 diff --git a/ghcide/test/data/import-placement/MultiLinePragma.hs b/ghcide/test/data/import-placement/MultiLinePragma.hs new file mode 100644 index 00000000000..e3e61871933 --- /dev/null +++ b/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 diff --git a/ghcide/test/data/import-placement/OptionsNotAtTopWithSpaces.expected.hs b/ghcide/test/data/import-placement/OptionsNotAtTopWithSpaces.expected.hs new file mode 100644 index 00000000000..912d6a210c9 --- /dev/null +++ b/ghcide/test/data/import-placement/OptionsNotAtTopWithSpaces.expected.hs @@ -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 diff --git a/ghcide/test/data/import-placement/OptionsNotAtTopWithSpaces.hs b/ghcide/test/data/import-placement/OptionsNotAtTopWithSpaces.hs new file mode 100644 index 00000000000..9b49dacfba2 --- /dev/null +++ b/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 diff --git a/ghcide/test/data/import-placement/OptionsPragmaNotAtTop.expected.hs b/ghcide/test/data/import-placement/OptionsPragmaNotAtTop.expected.hs new file mode 100644 index 00000000000..55a6c60dbb1 --- /dev/null +++ b/ghcide/test/data/import-placement/OptionsPragmaNotAtTop.expected.hs @@ -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 diff --git a/ghcide/test/data/import-placement/OptionsPragmaNotAtTop.hs b/ghcide/test/data/import-placement/OptionsPragmaNotAtTop.hs new file mode 100644 index 00000000000..ad7c01f4e7a --- /dev/null +++ b/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 diff --git a/ghcide/test/data/import-placement/PragmaNotAtTopMultipleComments.expected.hs b/ghcide/test/data/import-placement/PragmaNotAtTopMultipleComments.expected.hs new file mode 100644 index 00000000000..eead1cb55e3 --- /dev/null +++ b/ghcide/test/data/import-placement/PragmaNotAtTopMultipleComments.expected.hs @@ -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 diff --git a/ghcide/test/data/import-placement/PragmaNotAtTopMultipleComments.hs b/ghcide/test/data/import-placement/PragmaNotAtTopMultipleComments.hs new file mode 100644 index 00000000000..306af5aa714 --- /dev/null +++ b/ghcide/test/data/import-placement/PragmaNotAtTopMultipleComments.hs @@ -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 diff --git a/ghcide/test/data/import-placement/PragmaNotAtTopWithCommentsAtTop.expected.hs b/ghcide/test/data/import-placement/PragmaNotAtTopWithCommentsAtTop.expected.hs new file mode 100644 index 00000000000..57fc1614bef --- /dev/null +++ b/ghcide/test/data/import-placement/PragmaNotAtTopWithCommentsAtTop.expected.hs @@ -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 diff --git a/ghcide/test/data/import-placement/PragmaNotAtTopWithCommentsAtTop.hs b/ghcide/test/data/import-placement/PragmaNotAtTopWithCommentsAtTop.hs new file mode 100644 index 00000000000..c50fe08c853 --- /dev/null +++ b/ghcide/test/data/import-placement/PragmaNotAtTopWithCommentsAtTop.hs @@ -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 diff --git a/ghcide/test/data/import-placement/PragmaNotAtTopWithImports.expected.hs b/ghcide/test/data/import-placement/PragmaNotAtTopWithImports.expected.hs new file mode 100644 index 00000000000..f2525d60e8f --- /dev/null +++ b/ghcide/test/data/import-placement/PragmaNotAtTopWithImports.expected.hs @@ -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 diff --git a/ghcide/test/data/import-placement/PragmaNotAtTopWithImports.hs b/ghcide/test/data/import-placement/PragmaNotAtTopWithImports.hs new file mode 100644 index 00000000000..849c029069c --- /dev/null +++ b/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 diff --git a/ghcide/test/data/import-placement/PragmaNotAtTopWithModuleDecl.expected.hs b/ghcide/test/data/import-placement/PragmaNotAtTopWithModuleDecl.expected.hs new file mode 100644 index 00000000000..d62e2e32f1a --- /dev/null +++ b/ghcide/test/data/import-placement/PragmaNotAtTopWithModuleDecl.expected.hs @@ -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 diff --git a/ghcide/test/data/import-placement/PragmaNotAtTopWithModuleDecl.hs b/ghcide/test/data/import-placement/PragmaNotAtTopWithModuleDecl.hs new file mode 100644 index 00000000000..6115d25973f --- /dev/null +++ b/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 diff --git a/ghcide/test/data/import-placement/ShebangNotAtTop.expected.hs b/ghcide/test/data/import-placement/ShebangNotAtTop.expected.hs new file mode 100644 index 00000000000..09e503ddd36 --- /dev/null +++ b/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 diff --git a/ghcide/test/data/import-placement/ShebangNotAtTop.hs b/ghcide/test/data/import-placement/ShebangNotAtTop.hs new file mode 100644 index 00000000000..ee512102d55 --- /dev/null +++ b/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 diff --git a/ghcide/test/data/import-placement/ShebangNotAtTopNoSpace.expected.hs b/ghcide/test/data/import-placement/ShebangNotAtTopNoSpace.expected.hs new file mode 100644 index 00000000000..b3673142388 --- /dev/null +++ b/ghcide/test/data/import-placement/ShebangNotAtTopNoSpace.expected.hs @@ -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 diff --git a/ghcide/test/data/import-placement/ShebangNotAtTopNoSpace.hs b/ghcide/test/data/import-placement/ShebangNotAtTopNoSpace.hs new file mode 100644 index 00000000000..5ba507a5e73 --- /dev/null +++ b/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 diff --git a/ghcide/test/data/import-placement/ShebangNotAtTopWithSpaces.expected.hs b/ghcide/test/data/import-placement/ShebangNotAtTopWithSpaces.expected.hs new file mode 100644 index 00000000000..4c6cbe39175 --- /dev/null +++ b/ghcide/test/data/import-placement/ShebangNotAtTopWithSpaces.expected.hs @@ -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 diff --git a/ghcide/test/data/import-placement/ShebangNotAtTopWithSpaces.hs b/ghcide/test/data/import-placement/ShebangNotAtTopWithSpaces.hs new file mode 100644 index 00000000000..df312b2044c --- /dev/null +++ b/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 diff --git a/ghcide/test/data/import-placement/WhereDeclLowerInFile.expected.hs b/ghcide/test/data/import-placement/WhereDeclLowerInFile.expected.hs new file mode 100644 index 00000000000..53788dfaa82 --- /dev/null +++ b/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 diff --git a/ghcide/test/data/import-placement/WhereDeclLowerInFile.hs b/ghcide/test/data/import-placement/WhereDeclLowerInFile.hs new file mode 100644 index 00000000000..84f31f07a76 --- /dev/null +++ b/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 diff --git a/ghcide/test/data/import-placement/WhereKeywordLowerInFileNoExports.expected.hs b/ghcide/test/data/import-placement/WhereKeywordLowerInFileNoExports.expected.hs new file mode 100644 index 00000000000..644fd3abab3 --- /dev/null +++ b/ghcide/test/data/import-placement/WhereKeywordLowerInFileNoExports.expected.hs @@ -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 diff --git a/ghcide/test/data/import-placement/WhereKeywordLowerInFileNoExports.hs b/ghcide/test/data/import-placement/WhereKeywordLowerInFileNoExports.hs new file mode 100644 index 00000000000..caceb1d25de --- /dev/null +++ b/ghcide/test/data/import-placement/WhereKeywordLowerInFileNoExports.hs @@ -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 diff --git a/ghcide/test/exe/Main.hs b/ghcide/test/exe/Main.hs index 75bd665013c..c37d11d8d05 100644 --- a/ghcide/test/exe/Main.hs +++ b/ghcide/test/exe/Main.hs @@ -855,7 +855,29 @@ watchedFilesTests = testGroup "watched files" insertImportTests :: TestTree insertImportTests = testGroup "insert import" - [ checkImport "above comment at top of module" "CommentAtTop.hs" "CommentAtTop.expected.hs" "import Data.Monoid" + [ expectFailBecause "'findPositionFromImportsOrModuleDecl' function adds import directly under line with module declaration, not accounting for case when 'where' keyword is placed on lower line" + (checkImport "module where keyword lower in file no exports" "WhereKeywordLowerInFileNoExports.hs" "WhereKeywordLowerInFileNoExports.expected.hs" "import Data.Int") + , expectFailBecause "'findPositionFromImportsOrModuleDecl' function adds import directly under line with module exports list, not accounting for case when 'where' keyword is placed on lower line" + (checkImport "module where keyword lower in file with exports" "WhereDeclLowerInFile.hs" "WhereDeclLowerInFile.expected.hs" "import Data.Int") + , expectFailBecause "'findNextPragmaPosition' function doesn't account for case when shebang is not placed at top of file" + (checkImport "Shebang not at top with spaces" "ShebangNotAtTopWithSpaces.hs" "ShebangNotAtTopWithSpaces.expected.hs" "import Data.Monoid") + , expectFailBecause "'findNextPragmaPosition' function doesn't account for case when shebang is not placed at top of file" + (checkImport "Shebang not at top no space" "ShebangNotAtTopNoSpace.hs" "ShebangNotAtTopNoSpace.expected.hs" "import Data.Monoid") + , expectFailBecause "'findNextPragmaPosition' function doesn't account for case when OPTIONS_GHC pragma is not placed at top of file" + (checkImport "OPTIONS_GHC pragma not at top with spaces" "OptionsNotAtTopWithSpaces.hs" "OptionsNotAtTopWithSpaces.expected.hs" "import Data.Monoid") + , expectFailBecause "'findNextPragmaPosition' function doesn't account for case when shebang is not placed at top of file" + (checkImport "Shebang not at top of file" "ShebangNotAtTop.hs" "ShebangNotAtTop.expected.hs" "import Data.Monoid") + , expectFailBecause "'findNextPragmaPosition' function doesn't account for case when OPTIONS_GHC is not placed at top of file" + (checkImport "OPTIONS_GHC pragma not at top of file" "OptionsPragmaNotAtTop.hs" "OptionsPragmaNotAtTop.expected.hs" "import Data.Monoid") + , expectFailBecause "'findNextPragmaPosition' function doesn't account for case when OPTIONS_GHC pragma is not placed at top of file" + (checkImport "pragma not at top with comment at top" "PragmaNotAtTopWithCommentsAtTop.hs" "PragmaNotAtTopWithCommentsAtTop.expected.hs" "import Data.Monoid") + , expectFailBecause "'findNextPragmaPosition' function doesn't account for case when OPTIONS_GHC pragma is not placed at top of file" + (checkImport "pragma not at top multiple comments" "PragmaNotAtTopMultipleComments.hs" "PragmaNotAtTopMultipleComments.expected.hs" "import Data.Monoid") + , checkImport "pragmas not at top with module declaration" "PragmaNotAtTopWithModuleDecl.hs" "PragmaNotAtTopWithModuleDecl.expected.hs" "import Data.Monoid" + , expectFailBecause "'findNextPragmaPosition' function doesn't account for case of multiline pragmas" + (checkImport "after multiline language pragmas" "MultiLinePragma.hs" "MultiLinePragma.expected.hs" "import Data.Monoid") + , checkImport "pragmas not at top with imports" "PragmaNotAtTopWithImports.hs" "PragmaNotAtTopWithImports.expected.hs" "import Data.Monoid" + , checkImport "above comment at top of module" "CommentAtTop.hs" "CommentAtTop.expected.hs" "import Data.Monoid" , checkImport "above multiple comments below" "CommentAtTopMultipleComments.hs" "CommentAtTopMultipleComments.expected.hs" "import Data.Monoid" , checkImport "above curly brace comment" "CommentCurlyBraceAtTop.hs" "CommentCurlyBraceAtTop.expected.hs" "import Data.Monoid" , checkImport "above multi-line comment" "MultiLineCommentAtTop.hs" "MultiLineCommentAtTop.expected.hs" "import Data.Monoid"