@@ -333,6 +333,60 @@ async fn test_positional_params(test_db: PgPool) {
333333 assert_eq ! ( diagnostics. len( ) , 0 , "Expected no diagnostic" ) ;
334334}
335335
336+ #[ sqlx:: test( migrator = "pgt_test_utils::MIGRATIONS" ) ]
337+ async fn test_cstyle_comments ( test_db : PgPool ) {
338+ let mut conf = PartialConfiguration :: init ( ) ;
339+ conf. merge_with ( PartialConfiguration {
340+ db : Some ( PartialDatabaseConfiguration {
341+ database : Some (
342+ test_db
343+ . connect_options ( )
344+ . get_database ( )
345+ . unwrap ( )
346+ . to_string ( ) ,
347+ ) ,
348+ ..Default :: default ( )
349+ } ) ,
350+ ..Default :: default ( )
351+ } ) ;
352+
353+ let workspace = get_test_workspace ( Some ( conf) ) . expect ( "Unable to create test workspace" ) ;
354+
355+ let path = PgTPath :: new ( "test.sql" ) ;
356+
357+ let content = r#"
358+ /*
359+ * a
360+ * multi-line
361+ * comment.
362+ */
363+ select 1; /* Another comment */
364+ -- A single line comment
365+ select 2; -- Another single line comment
366+ "# ;
367+
368+ workspace
369+ . open_file ( OpenFileParams {
370+ path : path. clone ( ) ,
371+ content : content. into ( ) ,
372+ version : 1 ,
373+ } )
374+ . expect ( "Unable to open test file" ) ;
375+
376+ let diagnostics = workspace
377+ . pull_diagnostics ( crate :: workspace:: PullDiagnosticsParams {
378+ path : path. clone ( ) ,
379+ categories : RuleCategories :: all ( ) ,
380+ max_diagnostics : 100 ,
381+ only : vec ! [ ] ,
382+ skip : vec ! [ ] ,
383+ } )
384+ . expect ( "Unable to pull diagnostics" )
385+ . diagnostics ;
386+
387+ assert_eq ! ( diagnostics. len( ) , 0 , "Expected no diagnostic" ) ;
388+ }
389+
336390#[ sqlx:: test( migrator = "pgt_test_utils::MIGRATIONS" ) ]
337391async fn test_search_path_configuration ( test_db : PgPool ) {
338392 // Setup test schemas and functions
0 commit comments