@@ -1042,4 +1042,35 @@ mod tests {
10421042 assert ! ( result. suggestions. iter( ) . any( |s| s == "Country" ) ,
10431043 "Should suggest Country for partial 'coun'. Got: {:?}" , result. suggestions) ;
10441044 }
1045+
1046+ #[ test]
1047+ fn test_order_by_quoted_partial_completion ( ) {
1048+ let parser = CursorAwareParser :: new ( ) ;
1049+ let mut parser = parser;
1050+ parser. update_single_table (
1051+ "customers" . to_string ( ) ,
1052+ vec ! [
1053+ "City" . to_string( ) ,
1054+ "Company" . to_string( ) ,
1055+ "Country" . to_string( ) ,
1056+ "Customer Id" . to_string( ) ,
1057+ ] ,
1058+ ) ;
1059+
1060+ // Test ORDER BY completion with partial quoted identifier
1061+ let query = r#"select City,Company,Country,"Customer Id" from customers order by City, "Customer"# ;
1062+ let result = parser. get_completions ( query, query. len ( ) ) ;
1063+
1064+ // The partial word should be "Customer
1065+ assert_eq ! ( result. partial_word, Some ( "\" Customer" . to_string( ) ) ,
1066+ "Should extract '\" Customer' as partial" ) ;
1067+
1068+ // Should suggest "Customer Id" with proper quotes
1069+ assert ! ( result. suggestions. iter( ) . any( |s| s == "\" Customer Id\" " ) ,
1070+ "Should suggest properly quoted 'Customer Id' for partial '\" Customer'. Got: {:?}" , result. suggestions) ;
1071+
1072+ // Should NOT have truncated suggestions like "Customer
1073+ assert ! ( !result. suggestions. iter( ) . any( |s| s == "\" Customer" ) ,
1074+ "Should not have truncated suggestion '\" Customer'. Got: {:?}" , result. suggestions) ;
1075+ }
10451076}
0 commit comments