File tree 2 files changed +41
-0
lines changed
2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -561,6 +561,35 @@ missingPragmaTests = testGroup "missing pragma warning code actions" [
561
561
, " "
562
562
, " f Record{a, b} = a"
563
563
]
564
+ liftIO $ T. lines contents @?= expected
565
+ , testCase " After Shebang" $ do
566
+ runSession hlsCommand fullCaps " test/testdata/addPragmas" $ do
567
+ doc <- openDoc " AfterShebang.hs" " haskell"
568
+
569
+ _ <- waitForDiagnosticsFrom doc
570
+ cas <- map fromAction <$> getAllCodeActions doc
571
+
572
+ liftIO $ " Add \" NamedFieldPuns\" " `elem` map (^. L. title) cas @? " Contains NamedFieldPuns code action"
573
+
574
+ executeCodeAction $ head cas
575
+
576
+ contents <- documentContents doc
577
+
578
+ let expected =
579
+ [ " #! /usr/bin/env nix-shell"
580
+ , " #! nix-shell --pure -i runghc -p \" haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])\" "
581
+ , " "
582
+ , " {-# LANGUAGE NamedFieldPuns #-}"
583
+ , " module AfterShebang where"
584
+ , " "
585
+ , " data Record = Record"
586
+ , " { a :: Int,"
587
+ , " b :: Double,"
588
+ , " c :: String"
589
+ , " }"
590
+ , " "
591
+ , " f Record{a, b} = a"
592
+ ]
564
593
565
594
liftIO $ T. lines contents @?= expected
566
595
]
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env nix-shell
2
+ #! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (hp: with hp; [ turtle ])"
3
+
4
+ module AfterShebang where
5
+
6
+ data Record = Record
7
+ { a :: Int ,
8
+ b :: Double ,
9
+ c :: String
10
+ }
11
+
12
+ f Record {a, b} = a
You can’t perform that action at this time.
0 commit comments