@@ -56,7 +56,7 @@ spec = describe "Context of different cursor positions" $ do
5656
5757 actual `shouldBe` res
5858
59- it " value context" $ withCurrentDirectory " ./test/testdata/context" $ do
59+ it " value addition context" $ withCurrentDirectory " ./test/testdata/context" $ do
6060 fp_ <- makeAbsolute " ./ExampleContext.hs"
6161 let res = IdeResultOk (Just ValueContext )
6262 actual <- getContextAt fp_ (toPos (7 , 12 ))
@@ -70,6 +70,13 @@ spec = describe "Context of different cursor positions" $ do
7070
7171 actual `shouldBe` res
7272
73+ it " import list context" $ withCurrentDirectory " ./test/testdata/context" $ do
74+ fp_ <- makeAbsolute " ./ExampleContext.hs"
75+ let res = IdeResultOk (Just (ImportListContext " Data.List" ))
76+ actual <- getContextAt fp_ (toPos (3 , 20 ))
77+
78+ actual `shouldBe` res
79+
7380 it " function declaration context"
7481 $ withCurrentDirectory " ./test/testdata/context"
7582 $ do
@@ -96,6 +103,62 @@ spec = describe "Context of different cursor positions" $ do
96103 actual <- getContextAt fp_ (toPos (6 , 8 ))
97104 actual `shouldBe` res
98105
106+ it " data declaration context"
107+ $ withCurrentDirectory " ./test/testdata/context"
108+ $ do
109+ fp_ <- makeAbsolute " ./ExampleContext.hs"
110+ let res = IdeResultOk Nothing
111+ actual <- getContextAt fp_ (toPos (9 , 8 ))
112+ actual `shouldBe` res
113+
114+ it " class declaration context"
115+ $ withCurrentDirectory " ./test/testdata/context"
116+ $ do
117+ fp_ <- makeAbsolute " ./ExampleContext.hs"
118+ let res = IdeResultOk (Just ClassContext )
119+ actual <- getContextAt fp_ (toPos (12 , 8 ))
120+ actual `shouldBe` res
121+
122+ it " class declaration function sig context"
123+ $ withCurrentDirectory " ./test/testdata/context"
124+ $ do
125+ fp_ <- makeAbsolute " ./ExampleContext.hs"
126+ let res = IdeResultOk (Just ClassContext )
127+ actual <- getContextAt fp_ (toPos (13 , 7 ))
128+ actual `shouldBe` res
129+
130+ it " instance declaration context"
131+ $ withCurrentDirectory " ./test/testdata/context"
132+ $ do
133+ fp_ <- makeAbsolute " ./ExampleContext.hs"
134+ let res = IdeResultOk (Just InstanceContext )
135+ actual <- getContextAt fp_ (toPos (15 , 7 ))
136+ actual `shouldBe` res
137+
138+ it " instance declaration function def context"
139+ $ withCurrentDirectory " ./test/testdata/context"
140+ $ do
141+ fp_ <- makeAbsolute " ./ExampleContext.hs"
142+ let res = IdeResultOk (Just InstanceContext )
143+ actual <- getContextAt fp_ (toPos (16 , 6 ))
144+ actual `shouldBe` res
145+
146+ it " deriving context"
147+ $ withCurrentDirectory " ./test/testdata/context"
148+ $ do
149+ fp_ <- makeAbsolute " ./ExampleContext.hs"
150+ let res = IdeResultOk Nothing
151+ actual <- getContextAt fp_ (toPos (10 , 9 ))
152+ actual `shouldBe` res
153+
154+ it " deriving typeclass context"
155+ $ withCurrentDirectory " ./test/testdata/context"
156+ $ do
157+ fp_ <- makeAbsolute " ./ExampleContext.hs"
158+ let res = IdeResultOk (Just TypeContext )
159+ actual <- getContextAt fp_ (toPos (10 , 18 ))
160+ actual `shouldBe` res
161+
99162 it " nothing" $ withCurrentDirectory " ./test/testdata/context" $ do
100163 fp_ <- makeAbsolute " ./ExampleContext.hs"
101164 let res = IdeResultOk Nothing
0 commit comments