add extra undo test
This commit is contained in:
parent
cd0efc431d
commit
62e127d400
@ -437,3 +437,25 @@ TEST(BufferTest, non_adjacent_erases_create_a_single_change_operation)
|
|||||||
b.undo();
|
b.undo();
|
||||||
EXPECT_EQ(ss("abc\n"), b.get_string());
|
EXPECT_EQ(ss("abc\n"), b.get_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(BufferTest, inserting_at_beginning_and_end_of_line_in_insert_mode_creates_proper_undo_operation)
|
||||||
|
{
|
||||||
|
std::string s("abc\ndef\n");
|
||||||
|
Buffer b((const uint8_t *)&s[0], s.size());
|
||||||
|
auto it = b.add_cursor();
|
||||||
|
|
||||||
|
b.enter_insert_mode();
|
||||||
|
b.insert_code_point(*it, C('1'));
|
||||||
|
b.insert_code_point(*it, C('2'));
|
||||||
|
it->go_end_of_line(true);
|
||||||
|
b.insert_code_point(*it, C('3'));
|
||||||
|
b.insert_code_point(*it, C('4'));
|
||||||
|
b.exit_insert_mode();
|
||||||
|
EXPECT_EQ("12abc34\ndef\n", b.get_string());
|
||||||
|
|
||||||
|
b.undo();
|
||||||
|
EXPECT_EQ("abc\ndef\n", b.get_string());
|
||||||
|
|
||||||
|
b.redo();
|
||||||
|
EXPECT_EQ("12abc34\ndef\n", b.get_string());
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user