@@ -97,7 +97,7 @@ completionUnitTests = testGroup "Context Tests"
97
97
testCase " Inside Stanza - no keyword" $ do
98
98
-- on a file, where the library stanza has been defined
99
99
-- but no keyword is defined afterwards, the stanza context should be recognized
100
- getContext (Position 3 0 ) libraryStanzaData @?= Just (Stanza " library" , None ),
100
+ getContext (Position 3 2 ) libraryStanzaData @?= Just (Stanza " library" , None ),
101
101
testCase " Inside Stanza - keyword, no value" $ do
102
102
-- on a file, where the library stanza and a keyword
103
103
-- has been defined, the keyword and stanza should be recognized
@@ -123,7 +123,21 @@ completionUnitTests = testGroup "Context Tests"
123
123
-- if a keyword, other than the cabal version keyword has been written
124
124
-- with no value, even with multiple lines in between we can still write the
125
125
-- value corresponding to the keyword
126
- getContext (Position 5 4 ) topLevelData @?= Just (TopLevel , KeyWord " name:" )
126
+ getContext (Position 5 4 ) topLevelData @?= Just (TopLevel , KeyWord " name:" ),
127
+ testCase " Keyword inside stanza - cursor indented more than keyword in next line" $ do
128
+ -- if a keyword, other than the cabal version keyword has been written
129
+ -- in a stanza context with no value, then the value may be written in the next line,
130
+ -- when the cursor is indented more than the keyword
131
+ getContext (Position 5 8 ) libraryStanzaData @?= Just (Stanza " library" , KeyWord " build-depends:" ),
132
+ testCase " Keyword inside stanza - cursor indented less than keyword in next line" $ do
133
+ -- if a keyword, other than the cabal version keyword has been written
134
+ -- in a stanza context with no value, then the value may not be written in the next line,
135
+ -- when the cursor is indented less than the keyword
136
+ getContext (Position 5 2 ) libraryStanzaData @?= Just (Stanza " library" , None ),
137
+ testCase " Keyword inside stanza - cursor at start of next line" $ do
138
+ -- in a stanza context with no value the value may not be written in the next line,
139
+ -- when the cursor is not indented and we are in the toplevel context
140
+ getContext (Position 5 0 ) libraryStanzaData @?= Just (TopLevel , None )
127
141
]
128
142
129
143
-- ------------------------------------------------------------------------
@@ -251,7 +265,8 @@ libraryStanzaData =
251
265
" name: simple-cabal" ,
252
266
" library " ,
253
267
" " ,
254
- " build-depends: "
268
+ " build-depends: " ,
269
+ " "
255
270
]
256
271
257
272
topLevelData :: [Text. Text ]
0 commit comments