Skip to content

Commit 85c560c

Browse files
committed
add test for pragma fix
1 parent 5f3afad commit 85c560c

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

plugins/hls-pragmas-plugin/test/Main.hs

+6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ codeActionTests =
3232
liftIO $ "Add \"FlexibleInstances\"" `elem` map (^. L.title) cas @? "Contains FlexibleInstances code action"
3333
executeCodeAction $ head cas
3434

35+
, goldenWithPragmas "adds LANGUAGE pragma correctly ignoring later INLINE pragma" "AddLanguagePragma" $ \doc -> do
36+
_ <- waitForDiagnosticsFrom doc
37+
cas <- map fromAction <$> getAllCodeActions doc
38+
liftIO $ "Add \"TupleSections\"" `elem` map (^. L.title) cas @? "Contains TupleSections code action"
39+
executeCodeAction $ head cas
40+
3541
, goldenWithPragmas "adds TypeApplications pragma" "TypeApplications" $ \doc -> do
3642
_ <- waitForDiagnosticsFrom doc
3743
cas <- map fromAction <$> getAllCodeActions doc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
{-# LANGUAGE TupleSections #-}
3+
4+
module NeedsLanguagePragms where
5+
6+
tupleSection = (1,) <$> Just 2
7+
8+
{-# INLINE addOne #-}
9+
addOne :: Int -> Int
10+
addOne x = x + 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
3+
module NeedsLanguagePragms where
4+
5+
tupleSection = (1,) <$> Just 2
6+
7+
{-# INLINE addOne #-}
8+
addOne :: Int -> Int
9+
addOne x = x + 1

0 commit comments

Comments
 (0)