1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
use claims::{assert_none, assert_some, assert_some_eq};
use super::*;
use crate::test_helpers::testers;
#[test]
fn on_fixup_keep_message() {
testers::module(
&["fixup aaa c1"],
&[Event::from(StandardEvent::FixupKeepMessage)],
|mut test_context| {
let mut module = create_list(&create_config(), test_context.take_todo_file());
_ = test_context.activate(&mut module, State::List);
_ = test_context.handle_all_events(&mut module);
let todo_file = module.todo_file.lock();
let line = todo_file.get_line(0).unwrap();
assert_some_eq!(line.option(), "-C");
},
);
}
#[test]
fn on_fixup_keep_message_with_editor() {
testers::module(
&["fixup aaa c1"],
&[Event::from(StandardEvent::FixupKeepMessageWithEditor)],
|mut test_context| {
let mut module = create_list(&create_config(), test_context.take_todo_file());
_ = test_context.activate(&mut module, State::List);
_ = test_context.handle_all_events(&mut module);
let todo_file = module.todo_file.lock();
let line = todo_file.get_line(0).unwrap();
assert_some_eq!(line.option(), "-c");
},
);
}
#[test]
fn on_existing_option_remove_option() {
testers::module(
&["fixup -c aaa c1"],
&[Event::from(StandardEvent::FixupKeepMessageWithEditor)],
|mut test_context| {
let mut module = create_list(&create_config(), test_context.take_todo_file());
_ = test_context.activate(&mut module, State::List);
_ = test_context.handle_all_events(&mut module);
let todo_file = module.todo_file.lock();
let line = todo_file.get_line(0).unwrap();
assert_none!(line.option());
},
);
}
#[test]
fn after_select_line() {
testers::module(
&["fixup aaa c1", "fixup aaa c2", "fixup aaa c3"],
&[Event::from(StandardEvent::MoveCursorDown), Event::from('u')],
|mut test_context| {
let mut module = create_list(&create_config(), test_context.take_todo_file());
_ = test_context.activate(&mut module, State::List);
_ = test_context.handle_all_events(&mut module);
assert_none!(module.todo_file.lock().get_line(0).unwrap().option());
assert_some!(module.todo_file.lock().get_line(1).unwrap().option());
assert_none!(module.todo_file.lock().get_line(2).unwrap().option());
},
);
}
|