()
| 2 | |
| 3 | #[test] |
| 4 | fn test_match_enum() { |
| 5 | static INPUT: &str = r#" |
| 6 | impl From<SpecialHandlingShortcut> for SpecialHandling { |
| 7 | fn from(shortcut: SpecialHandlingShortcut) -> Self { |
| 8 | use Directive::*; |
| 9 | match shortcut { |
| 10 | SpecialHandlingShortcut::None => SpecialHandling { |
| 11 | show: Default, list: Default, sum: Default, |
| 12 | }, |
| 13 | SpecialHandlingShortcut::Enter => SpecialHandling { |
| 14 | show: Always, list: Always, sum: Always, |
| 15 | }, |
| 16 | SpecialHandlingShortcut::NoEnter => SpecialHandling { |
| 17 | show: Default, list: Never, sum: Never, |
| 18 | }, |
| 19 | SpecialHandlingShortcut::Hide => SpecialHandling { |
| 20 | show: Never, list: Default, sum: Never, |
| 21 | }, |
| 22 | SpecialHandlingShortcut::NoHide => SpecialHandling { |
| 23 | show: Always, list: Default, sum: Default, |
| 24 | }, |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | "#; |
| 29 | static OUTPUT: &str = r#" |
| 30 | impl From<SpecialHandlingShortcut> for SpecialHandling { |
| 31 | fn from(shortcut: SpecialHandlingShortcut) -> Self { |
| 32 | use Directive::*; |
| 33 | match shortcut { |
| 34 | SpecialHandlingShortcut::Enter => SpecialHandling { |
| 35 | show: Always, list: Always, sum: Always, |
| 36 | }, |
| 37 | SpecialHandlingShortcut::Hide => SpecialHandling { |
| 38 | show: Never, list: Default, sum: Never, |
| 39 | }, |
| 40 | SpecialHandlingShortcut::NoEnter => SpecialHandling { |
| 41 | show: Default, list: Never, sum: Never, |
| 42 | }, |
| 43 | SpecialHandlingShortcut::NoHide => SpecialHandling { |
| 44 | show: Always, list: Default, sum: Default, |
| 45 | }, |
| 46 | SpecialHandlingShortcut::None => SpecialHandling { |
| 47 | show: Default, list: Default, sum: Default, |
| 48 | }, |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | "#; |
| 53 | let list = LocList::read_str(INPUT, Language::Rust).unwrap(); |
| 54 | let focused = list.focus_around_line_index(7).unwrap(); |
| 55 | let sorted_list = focused.sort(); |
| 56 | assert_eq!(sorted_list.to_string(), OUTPUT); |
| 57 | } |
nothing calls this directly
no test coverage detected