@@ -65,13 +65,15 @@ fn get_completion_text(ctx: &CompletionContext, func: &Function) -> CompletionTe
6565
6666#[ cfg( test) ]
6767mod tests {
68+ use sqlx:: PgPool ;
69+
6870 use crate :: {
6971 CompletionItem , CompletionItemKind , complete,
7072 test_helper:: { CURSOR_POS , get_test_deps, get_test_params} ,
7173 } ;
7274
73- #[ tokio :: test]
74- async fn completes_fn ( ) {
75+ #[ sqlx :: test( migrator = "pgt_test_utils::MIGRATIONS" ) ]
76+ async fn completes_fn ( pool : PgPool ) {
7577 let setup = r#"
7678 create or replace function cool()
7779 returns trigger
@@ -86,7 +88,7 @@ mod tests {
8688
8789 let query = format ! ( "select coo{}" , CURSOR_POS ) ;
8890
89- let ( tree, cache) = get_test_deps ( setup, query. as_str ( ) . into ( ) ) . await ;
91+ let ( tree, cache) = get_test_deps ( Some ( setup) , query. as_str ( ) . into ( ) , & pool ) . await ;
9092 let params = get_test_params ( & tree, & cache, query. as_str ( ) . into ( ) ) ;
9193 let results = complete ( params) ;
9294
@@ -98,8 +100,8 @@ mod tests {
98100 assert_eq ! ( label, "cool" ) ;
99101 }
100102
101- #[ tokio :: test]
102- async fn prefers_fn_if_invocation ( ) {
103+ #[ sqlx :: test( migrator = "pgt_test_utils::MIGRATIONS" ) ]
104+ async fn prefers_fn_if_invocation ( pool : PgPool ) {
103105 let setup = r#"
104106 create table coos (
105107 id serial primary key,
@@ -119,7 +121,7 @@ mod tests {
119121
120122 let query = format ! ( r#"select * from coo{}()"# , CURSOR_POS ) ;
121123
122- let ( tree, cache) = get_test_deps ( setup, query. as_str ( ) . into ( ) ) . await ;
124+ let ( tree, cache) = get_test_deps ( Some ( setup) , query. as_str ( ) . into ( ) , & pool ) . await ;
123125 let params = get_test_params ( & tree, & cache, query. as_str ( ) . into ( ) ) ;
124126 let results = complete ( params) ;
125127
@@ -132,8 +134,8 @@ mod tests {
132134 assert_eq ! ( kind, CompletionItemKind :: Function ) ;
133135 }
134136
135- #[ tokio :: test]
136- async fn prefers_fn_in_select_clause ( ) {
137+ #[ sqlx :: test( migrator = "pgt_test_utils::MIGRATIONS" ) ]
138+ async fn prefers_fn_in_select_clause ( pool : PgPool ) {
137139 let setup = r#"
138140 create table coos (
139141 id serial primary key,
@@ -153,7 +155,7 @@ mod tests {
153155
154156 let query = format ! ( r#"select coo{}"# , CURSOR_POS ) ;
155157
156- let ( tree, cache) = get_test_deps ( setup, query. as_str ( ) . into ( ) ) . await ;
158+ let ( tree, cache) = get_test_deps ( Some ( setup) , query. as_str ( ) . into ( ) , & pool ) . await ;
157159 let params = get_test_params ( & tree, & cache, query. as_str ( ) . into ( ) ) ;
158160 let results = complete ( params) ;
159161
@@ -166,8 +168,8 @@ mod tests {
166168 assert_eq ! ( kind, CompletionItemKind :: Function ) ;
167169 }
168170
169- #[ tokio :: test]
170- async fn prefers_function_in_from_clause_if_invocation ( ) {
171+ #[ sqlx :: test( migrator = "pgt_test_utils::MIGRATIONS" ) ]
172+ async fn prefers_function_in_from_clause_if_invocation ( pool : PgPool ) {
171173 let setup = r#"
172174 create table coos (
173175 id serial primary key,
@@ -187,7 +189,7 @@ mod tests {
187189
188190 let query = format ! ( r#"select * from coo{}()"# , CURSOR_POS ) ;
189191
190- let ( tree, cache) = get_test_deps ( setup, query. as_str ( ) . into ( ) ) . await ;
192+ let ( tree, cache) = get_test_deps ( Some ( setup) , query. as_str ( ) . into ( ) , & pool ) . await ;
191193 let params = get_test_params ( & tree, & cache, query. as_str ( ) . into ( ) ) ;
192194 let results = complete ( params) ;
193195
0 commit comments