test number of change operations created in basic undo/redo tests

This commit is contained in:
Josh Holtrop 2017-01-15 20:27:26 -05:00
parent 861aaed940
commit 3e50e8a3b3

View File

@ -152,6 +152,7 @@ TEST(BufferTest, allows_undo_and_redo_of_inserts)
b.exit_insert_mode();
EXPECT_EQ(ss("12abc\ndef\nghi\n"), b.get_string());
EXPECT_EQ(C('a'), **it);
EXPECT_EQ(1u, b.m_change_operations.size());
it->go_next_line();
it->go_right_in_line(false);
@ -160,11 +161,13 @@ TEST(BufferTest, allows_undo_and_redo_of_inserts)
b.exit_insert_mode();
EXPECT_EQ(ss("12abc\nd3ef\nghi\n"), b.get_string());
EXPECT_EQ(C('e'), **it);
EXPECT_EQ(2u, b.m_change_operations.size());
it->go_end_of_line(true);
b.insert_code_point(*it, C('$'));
EXPECT_EQ(ss("12abc\nd3ef$\nghi\n"), b.get_string());
EXPECT_EQ(C('\n'), **it);
EXPECT_EQ(3u, b.m_change_operations.size());
it->go_start_of_line();
EXPECT_EQ(C('d'), **it);
@ -203,17 +206,20 @@ TEST(BufferTest, allows_undo_and_redo_of_erases)
b.erase_code_point(*it);
EXPECT_EQ(ss("bc\ndef\nghi\n"), b.get_string());
EXPECT_EQ(C('b'), **it);
EXPECT_EQ(1u, b.m_change_operations.size());
it->go_next_line();
it->go_right_in_line(false);
b.erase_code_point(*it);
EXPECT_EQ(ss("bc\ndf\nghi\n"), b.get_string());
EXPECT_EQ(C('f'), **it);
EXPECT_EQ(2u, b.m_change_operations.size());
it->go_end_of_line(true);
b.erase_code_point(*it);
EXPECT_EQ(ss("bc\ndfghi\n"), b.get_string());
EXPECT_EQ(C('g'), **it);
EXPECT_EQ(3u, b.m_change_operations.size());
it->go_left_in_line();
EXPECT_EQ(C('f'), **it);