update BufferLineWalker unit tests for full coverage
This commit is contained in:
parent
74dfb7ce78
commit
7ad28ceb67
@ -33,6 +33,11 @@ TEST(BufferLineWalkerTest, iterats_once_for_empty_line)
|
||||
iter_count++;
|
||||
}
|
||||
EXPECT_EQ(1, iter_count);
|
||||
EXPECT_FALSE(blw.is_valid());
|
||||
EXPECT_FALSE(blw.is_eol());
|
||||
blw++;
|
||||
EXPECT_FALSE(blw.is_valid());
|
||||
EXPECT_FALSE(blw.is_eol());
|
||||
}
|
||||
|
||||
TEST(BufferLineWalkerTest, walks_correctly_with_tabs_and_no_line_wrapping)
|
||||
@ -63,22 +68,22 @@ TEST(BufferLineWalkerTest, walks_correctly_with_tabs_and_no_line_wrapping)
|
||||
|
||||
TEST(BufferLineWalkerTest, walks_correctly_with_tabs_and_line_wrapping)
|
||||
{
|
||||
static const char data[] = "\t1\t12\t123\t1234\t!";
|
||||
static const char data[] = "\t1\t12\t123\t1234\t\t!";
|
||||
std::shared_ptr<Buffer> b = std::make_shared<Buffer>((const uint8_t *)data, strlen(data));
|
||||
std::shared_ptr<Buffer::Iterator> start_of_line = b->add_iterator();
|
||||
BufferLineWalker blw(b, start_of_line, 5, cld);
|
||||
|
||||
static int expected_screen_columns[] = {
|
||||
0, 4, 0, 3, 4, 0, 2, 3, 4, 0, 1, 2, 3, 4, 0, 4, 0
|
||||
};
|
||||
static int expected_row_offsets[] = {
|
||||
0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 5
|
||||
0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 5, 5
|
||||
};
|
||||
static int expected_screen_columns[] = {
|
||||
0, 4, 0, 3, 4, 0, 2, 3, 4, 0, 1, 2, 3, 4, 0, 4, 3, 4
|
||||
};
|
||||
static int expected_virtual_columns[] = {
|
||||
0, 4, 5, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 24, 25
|
||||
0, 4, 5, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 24, 28, 29
|
||||
};
|
||||
static int expected_character_widths[] = {
|
||||
4, 1, 3, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 0
|
||||
4, 1, 3, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 1, 0
|
||||
};
|
||||
int iter_count = 0;
|
||||
for (; blw.is_valid(); blw++)
|
||||
|
Loading…
x
Reference in New Issue
Block a user