use codesort::*; static INPUT: &str = r#" trait Foo {} struct Bar(T); struct Baz(T); struct Blee(T); impl Foo for Blee where T: Copy, { // ... } impl Foo for Baz where T: Copy, { // ... } impl Foo for Bar where T: Copy, { // ... } fn main() {} "#; static OUTPUT: &str = r#" fn main() {} impl Foo for Bar where T: Copy, { // ... } impl Foo for Baz where T: Copy, { // ... } impl Foo for Blee where T: Copy, { // ... } struct Bar(T); struct Baz(T); struct Blee(T); trait Foo {} "#; /// check issue #4 is solved #[test] fn test_comma_in_trait_bound() { let list = LocList::read_str(INPUT, Language::Rust).unwrap(); //list.print_debug(" WHOLE "); let focused = list.focus_around_line_index(7).unwrap(); focused.print_debug(); { let blocks = focused.clone().focus.into_blocks(); for (i, block) in blocks.iter().enumerate() { block.print_debug(&format!(" BLOCK {i}")); } } let sorted_list = focused.sort(); sorted_list.print_debug(" SORTED "); assert_eq!(sorted_list.to_string(), OUTPUT); }