diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-01-22 13:39:29 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-01-22 13:39:29 +0000 |
| commit | cb197f57ba77ae16ed90d0e470f79d3245e16a70 (patch) | |
| tree | 680eba24571af275b81b84071b5805a3ca535797 /src/unit_tests.cc | |
| parent | 2516c16bb9b35db18661ab180a41b0e157addefb (diff) | |
Avoid temporary strings on buffer load/reload
Pass directly a Vector<ref_ptr<StringStorage>> to the buffer
Diffstat (limited to 'src/unit_tests.cc')
| -rw-r--r-- | src/unit_tests.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/unit_tests.cc b/src/unit_tests.cc index 4b8dcbda..504c9246 100644 --- a/src/unit_tests.cc +++ b/src/unit_tests.cc @@ -10,7 +10,7 @@ void test_buffer() { Buffer empty_buffer("empty", Buffer::Flags::None, {}); - Buffer buffer("test", Buffer::Flags::None, { "allo ?\n", "mais que fais la police\n", " hein ?\n", " youpi\n" }); + Buffer buffer("test", Buffer::Flags::None, { "allo ?\n"_ss, "mais que fais la police\n"_ss, " hein ?\n"_ss, " youpi\n"_ss }); kak_assert(buffer.line_count() == 4); BufferIterator pos = buffer.begin(); @@ -53,7 +53,7 @@ void test_buffer() void test_undo_group_optimizer() { - Vector<String> lines = { "allo ?\n", "mais que fais la police\n", " hein ?\n", " youpi\n" }; + BufferLines lines = { "allo ?\n"_ss, "mais que fais la police\n"_ss, " hein ?\n"_ss, " youpi\n"_ss }; Buffer buffer("test", Buffer::Flags::None, lines); auto pos = buffer.insert(buffer.end(), "kanaky\n"); buffer.erase(pos, buffer.end()); @@ -68,17 +68,17 @@ void test_undo_group_optimizer() kak_assert((int)buffer.line_count() == lines.size()); for (size_t i = 0; i < lines.size(); ++i) - kak_assert(lines[i] == buffer[LineCount((int)i)]); + kak_assert(SharedString{lines[i]} == buffer[LineCount((int)i)]); } void test_word_db() { Buffer buffer("test", Buffer::Flags::None, - { "tchou mutch\n", - "tchou kanaky tchou\n", - "\n", - "tchaa tchaa\n", - "allo\n"}); + { "tchou mutch\n"_ss, + "tchou kanaky tchou\n"_ss, + "\n"_ss, + "tchaa tchaa\n"_ss, + "allo\n"_ss}); WordDB word_db(buffer); auto res = word_db.find_matching("", prefix_match); std::sort(res.begin(), res.end()); |
