@@ -135,6 +135,64 @@ test_package_name_completion_on_typing_multiple_suggestions_when_invoked if {
135135 }
136136}
137137
138+ test_package_name_quoted if {
139+ policy := ` package f`
140+ provider_input := {" regal" : {
141+ " file" : {
142+ " name" : " /Users/joe/foo/bar/baz-are/foo/baz-are/foo/p.rego" ,
143+ " lines" : split (policy, " \n " ),
144+ },
145+ " context" : {
146+ " workspace_root" : " /Users/joe/policy" ,
147+ " location" : {
148+ " row" : 1 ,
149+ " col" : 10 ,
150+ },
151+ },
152+ " environment" : {" path_separator" : " /" },
153+ }}
154+
155+ items := provider.items with input as provider_input
156+ items == {
157+ {
158+ " detail" : " suggested package name based on directory structure" ,
159+ " kind" : 19 ,
160+ " label" : " foo.bar[\" baz-are\" ].foo[\" baz-are\" ].foo" ,
161+ " textEdit" : {
162+ " newText" : " foo.bar[\" baz-are\" ].foo[\" baz-are\" ].foo\n\n " ,
163+ " range" : {
164+ " end" : {" character" : 9 , " line" : 0 },
165+ " start" : {" character" : 8 , " line" : 0 },
166+ },
167+ },
168+ },
169+ {
170+ " detail" : " suggested package name based on directory structure" ,
171+ " kind" : 19 ,
172+ " label" : " foo" ,
173+ " textEdit" : {
174+ " newText" : " foo\n\n " ,
175+ " range" : {
176+ " end" : {" character" : 9 , " line" : 0 },
177+ " start" : {" character" : 8 , " line" : 0 },
178+ },
179+ },
180+ },
181+ {
182+ " detail" : " suggested package name based on directory structure" ,
183+ " kind" : 19 ,
184+ " label" : " foo[\" baz-are\" ].foo" ,
185+ " textEdit" : {
186+ " newText" : " foo[\" baz-are\" ].foo\n\n " ,
187+ " range" : {
188+ " end" : {" character" : 9 , " line" : 0 },
189+ " start" : {" character" : 8 , " line" : 0 },
190+ },
191+ },
192+ },
193+ }
194+ }
195+
138196test_build_suggestions if {
139197 provider._suggestions (" foo.bar.baz" , " foo" ) == [" foo.bar.baz" ]
140198 provider._suggestions (" foo.bar.baz" , " bar" ) == [" bar.baz" ]
0 commit comments