add PieceTable::Cursor::operator*(), add unit test
This commit is contained in:
parent
abf853e1ba
commit
f6338da8d0
@ -63,6 +63,12 @@ public:
|
|||||||
|
|
||||||
/** Virtual column (0 based). */
|
/** Virtual column (0 based). */
|
||||||
uint32_t column;
|
uint32_t column;
|
||||||
|
|
||||||
|
uint32_t operator*() const
|
||||||
|
{
|
||||||
|
/* TODO: Use Encoding */
|
||||||
|
return piece->start[offset];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PieceTable(const uint8_t * file_buffer, unsigned long file_buffer_size);
|
PieceTable(const uint8_t * file_buffer, unsigned long file_buffer_size);
|
||||||
|
@ -21,3 +21,11 @@ TEST(BufferTest, writes_an_identical_file_to_what_is_loaded_if_no_changes_were_p
|
|||||||
TestSupport::compare_files(e, "test/tmp/f");
|
TestSupport::compare_files(e, "test/tmp/f");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(BufferTest, allows_navigating_using_cursors)
|
||||||
|
{
|
||||||
|
Buffer b;
|
||||||
|
ASSERT_TRUE(b.load_from_file("test/files/line_endings/lf_format.txt"));
|
||||||
|
std::shared_ptr<PieceTable::Cursor> cursor = b.piece_table->add_cursor();
|
||||||
|
EXPECT_EQ((uint32_t)'H', **cursor);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user