Fix unit tests broken by 08529fc

This commit is contained in:
Josh Holtrop 2017-01-19 15:05:32 -05:00
parent a65a9fec41
commit d1b2350e1a

View File

@ -119,6 +119,8 @@ TEST(BufferTest, allows_inserting_and_erasing_characters)
EXPECT_EQ(ss("1abc\ndef\nghi\n"), b.get_string()); EXPECT_EQ(ss("1abc\ndef\nghi\n"), b.get_string());
EXPECT_EQ(C('a'), **it); EXPECT_EQ(C('a'), **it);
b.enter_insert_mode();
it->go_end_of_line(true); it->go_end_of_line(true);
b.insert_code_point(*it, C('$')); b.insert_code_point(*it, C('$'));
EXPECT_EQ(ss("1abc$\ndef\nghi\n"), b.get_string()); EXPECT_EQ(ss("1abc$\ndef\nghi\n"), b.get_string());
@ -127,6 +129,8 @@ TEST(BufferTest, allows_inserting_and_erasing_characters)
b.erase_code_point(*it); b.erase_code_point(*it);
EXPECT_EQ(ss("1abc$def\nghi\n"), b.get_string()); EXPECT_EQ(ss("1abc$def\nghi\n"), b.get_string());
EXPECT_EQ(C('d'), **it); EXPECT_EQ(C('d'), **it);
b.exit_insert_mode();
} }
TEST(BufferTest, adds_a_newline_after_inserted_character_when_inserting_in_an_empty_buffer) TEST(BufferTest, adds_a_newline_after_inserted_character_when_inserting_in_an_empty_buffer)
@ -135,9 +139,11 @@ TEST(BufferTest, adds_a_newline_after_inserted_character_when_inserting_in_an_em
auto it = b.add_cursor(); auto it = b.add_cursor();
EXPECT_EQ(0u, it->offset()); EXPECT_EQ(0u, it->offset());
b.enter_insert_mode();
b.insert_code_point(*it, C('J')); b.insert_code_point(*it, C('J'));
EXPECT_EQ(ss("J\n"), b.get_string()); EXPECT_EQ(ss("J\n"), b.get_string());
EXPECT_EQ(C('\n'), **it); EXPECT_EQ(C('\n'), **it);
b.exit_insert_mode();
} }
TEST(BufferTest, allows_undo_and_redo_of_inserts) TEST(BufferTest, allows_undo_and_redo_of_inserts)
@ -166,7 +172,7 @@ TEST(BufferTest, allows_undo_and_redo_of_inserts)
it->go_end_of_line(true); it->go_end_of_line(true);
b.insert_code_point(*it, C('$')); b.insert_code_point(*it, C('$'));
EXPECT_EQ(ss("12abc\nd3ef$\nghi\n"), b.get_string()); EXPECT_EQ(ss("12abc\nd3ef$\nghi\n"), b.get_string());
EXPECT_EQ(C('\n'), **it); EXPECT_EQ(C('$'), **it); /* cursor moved back because not in insert mode */
EXPECT_EQ(3u, b.m_change_operations.size()); EXPECT_EQ(3u, b.m_change_operations.size());
it->go_start_of_line(); it->go_start_of_line();