@@ -847,21 +847,21 @@ mod tests {
847847 fn test_generate_docs_from_strs_with_paths_builds_tables_and_stamps_paths ( )
848848 -> Result < ( ) , Box < dyn std:: error:: Error > > {
849849 // Two simple SQL strings with distinct paths
850- let sql1 = r# "
850+ let sql1 = "
851851 -- Users table
852852 CREATE TABLE users (
853853 -- id
854854 id INTEGER PRIMARY KEY
855855 );
856- "# ;
856+ " ;
857857
858- let sql2 = r# "
858+ let sql2 = "
859859 /* Posts table */
860860 CREATE TABLE posts (
861861 /* primary key */
862862 id INTEGER PRIMARY KEY
863863 );
864- "# ;
864+ " ;
865865
866866 let p1 = PathBuf :: from ( "a/one.sql" ) ;
867867 let p2 = PathBuf :: from ( "b/two.sql" ) ;
@@ -899,7 +899,8 @@ mod tests {
899899
900900 let built = SqlDoc :: builder_from_strs_with_paths ( & inputs) . build ( ) ?;
901901
902- let names: Vec < & str > = built. tables ( ) . iter ( ) . map ( |t| t. name ( ) ) . collect ( ) ;
902+ let names: Vec < & str > =
903+ built. tables ( ) . iter ( ) . map ( super :: super :: docs:: TableDoc :: name) . collect ( ) ;
903904 assert_eq ! ( names, vec![ "alpha" , "beta" ] ) ;
904905
905906 assert_eq ! ( built. table( "alpha" , None ) ?. path( ) , Some ( path_a. as_path( ) ) ) ;
@@ -919,24 +920,23 @@ mod tests {
919920 Ok ( ( ) )
920921 }
921922 #[ test]
922- fn test_table_with_schema_not_found_uses_no_schema_provided_message ( ) {
923- use crate :: { SqlDoc , docs:: TableDoc , error:: DocError } ;
924-
925- let sql_doc = SqlDoc :: new ( vec ! [
926- TableDoc :: new( Some ( "analytics" . to_owned( ) ) , "events" . to_owned( ) , None , vec![ ] , None ) ,
927- TableDoc :: new( Some ( "public" . to_owned( ) ) , "events" . to_owned( ) , None , vec![ ] , None ) ,
928- ] ) ;
929-
930- match sql_doc. table ( "events" , None ) {
931- Err ( DocError :: TableWithSchemaNotFound { name, schema } ) => {
932- assert_eq ! ( name, "events" ) ;
933- assert_eq ! ( schema, "No schema provided" ) ;
923+ fn test_table_with_schema_not_found_uses_no_schema_provided_message ( ) {
924+ use crate :: { SqlDoc , docs:: TableDoc , error:: DocError } ;
925+
926+ let sql_doc = SqlDoc :: new ( vec ! [
927+ TableDoc :: new( Some ( "analytics" . to_owned( ) ) , "events" . to_owned( ) , None , vec![ ] , None ) ,
928+ TableDoc :: new( Some ( "public" . to_owned( ) ) , "events" . to_owned( ) , None , vec![ ] , None ) ,
929+ ] ) ;
930+
931+ match sql_doc. table ( "events" , None ) {
932+ Err ( DocError :: TableWithSchemaNotFound { name, schema } ) => {
933+ assert_eq ! ( name, "events" ) ;
934+ assert_eq ! ( schema, "No schema provided" ) ;
935+ }
936+ Err ( e) => {
937+ panic ! ( "expected TableWithSchemaNotFound with 'No schema provided', got: {e:?}" )
938+ }
939+ Ok ( _) => panic ! ( "expected error, got Ok" ) ,
934940 }
935- Err ( e) => panic ! (
936- "expected TableWithSchemaNotFound with 'No schema provided', got: {e:?}"
937- ) ,
938- Ok ( _) => panic ! ( "expected error, got Ok" ) ,
939941 }
940942}
941-
942- }
0 commit comments