@@ -411,30 +411,21 @@ fn vec_of_hashmap()
411411 let mut map = HashMap :: new( ) ;
412412 map. insert( "id" . to_string( ) , "1" . to_string( ) ) ;
413413 map. insert( "created_at" . to_string( ) , "1627845583" . to_string( ) ) ;
414- map. insert( "file_ids" . to_string( ) , "[ file1, file2 ]" . to_string( ) ) ;
415- map. insert( "tools" . to_string( ) , "" . to_string( ) ) ;
416414 map
417415 } ,
418416 {
419417 let mut map = HashMap :: new( ) ;
420418 map. insert( "id" . to_string( ) , "2" . to_string( ) ) ;
421419 map. insert( "created_at" . to_string( ) , "13" . to_string( ) ) ;
422- map. insert( "file_ids" . to_string( ) , "[ file3, file4 ]" . to_string( ) ) ;
423- map. insert( "tools" . to_string( ) , "tool1" . to_string( ) ) ;
424420 map
425421 } ,
426422 ] ;
427423
428- use the_module:: Fields ;
429-
430424 use std:: borrow:: Cow ;
431425
432- // let _ = <HashMap<std::string::String, std::string::String> as Fields<String, Option<Cow<'_, str>>>>::fields(&map);
433-
434426 use the_module:: TableFormatter ;
435- let _as_table : AsTable < ' _ , Vec < HashMap < String , String > > , & str , HashMap < String , String > , str > = AsTable :: new ( & data ) ;
436427
437- /*
428+ let _as_table : AsTable < ' _ , Vec < HashMap < String , String > > , & str , HashMap < String , String > , str > = AsTable :: new ( & data ) ;
438429 let as_table = AsTable :: new ( & data ) ;
439430
440431 let rows = TableRows :: rows ( & as_table ) ;
@@ -447,59 +438,9 @@ fn vec_of_hashmap()
447438
448439 let got = as_table. table_to_string ( ) ;
449440
450- assert!( got.contains( "│ id │ created_at │ file_ids │ tools │" ) );
451- assert!( got.contains( "│ 13 │ [ │ [ │" ) );
452- assert!( got.contains( "│ 1627845583 │ [ │ │" ) );
453- */
454- }
455-
456- #[ test ]
457- fn vec_of_hashmap_str ( )
458- {
459- let data : Vec < HashMap < & str , String > > = vec !
460- [
461- {
462- let mut map = HashMap :: new( ) ;
463- map. insert( "id" , "1" . to_string( ) ) ;
464- map. insert( "created_at" , "1627845583" . to_string( ) ) ;
465- map. insert( "file_ids" , "[ file1, file2 ]" . to_string( ) ) ;
466- map. insert( "tools" , "" . to_string( ) ) ;
467- map
468- } ,
469- {
470- let mut map = HashMap :: new( ) ;
471- map. insert( "id" , "2" . to_string( ) ) ;
472- map. insert( "created_at" , "13" . to_string( ) ) ;
473- map. insert( "file_ids" , "[ file3, file4 ]" . to_string( ) ) ;
474- map. insert( "tools" , "tool1" . to_string( ) ) ;
475- map
476- } ,
477- ] ;
478-
479- use the_module:: Fields ;
480-
481- use std:: borrow:: Cow ;
482-
483- // let _ = <HashMap<std::string::String, std::string::String> as Fields<String, Option<Cow<'_, str>>>>::fields(&map);
484-
485- use the_module:: TableFormatter ;
486- //let _as_table : AsTable< '_, Vec< HashMap< &str, String > >, &str, HashMap< &str, String >, str> = AsTable::new( &data );
487-
488- /*
489- let as_table = AsTable::new( &data );
490-
491- let rows = TableRows::rows( &as_table );
492- assert_eq!( rows.len(), 2 );
441+ println ! ( "{}" , got) ;
493442
494- let mut output = String::new();
495- let mut context = the_module::print::Context::new( &mut output, Default::default() );
496-
497- let _got = the_module::TableFormatter::fmt( &as_table, &mut context );
498-
499- let got = as_table.table_to_string();
500-
501- assert!( got.contains( "│ id │ created_at │ file_ids │ tools │" ) );
502- assert!( got.contains( "│ 13 │ [ │ [ │" ) );
503- assert!( got.contains( "│ 1627845583 │ [ │ │" ) );
504- */
443+ assert ! ( got. contains( "│ id │ created_at │" ) || got. contains( "│ created_at │ id │" ) ) ;
444+ assert ! ( got. contains( "│ 1 │ 1627845583 │" ) || got. contains( "│ 1627845583 │ 1 │" ) ) ;
445+ assert ! ( got. contains( "│ 2 │ 13 │" ) || got. contains( "│ 13 │ 2 │" ) ) ;
505446}
0 commit comments