Reformat code.
This commit is contained in:
29
Command.cc
29
Command.cc
@@ -1109,33 +1109,34 @@ cmd_theme_set_by_name(const CommandContext &ctx)
|
||||
static bool
|
||||
cmd_theme_set_by_name(CommandContext &ctx)
|
||||
{
|
||||
|
||||
# if defined(KTE_BUILD_GUI) && defined(KTE_USE_QT)
|
||||
// Qt GUI build: schedule theme change for frontend
|
||||
std::string name = ctx.arg;
|
||||
// trim spaces
|
||||
auto ltrim = [](std::string &s) {
|
||||
// Qt GUI build: schedule theme change for frontend
|
||||
std::string name = ctx.arg;
|
||||
// trim spaces
|
||||
auto ltrim = [](std::string &s) {
|
||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) {
|
||||
return !std::isspace(ch);
|
||||
}));
|
||||
};
|
||||
auto rtrim = [](std::string &s) {
|
||||
};
|
||||
auto rtrim = [](std::string &s) {
|
||||
s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) {
|
||||
return !std::isspace(ch);
|
||||
}).base(), s.end());
|
||||
};
|
||||
ltrim(name);
|
||||
rtrim(name);
|
||||
};
|
||||
ltrim (name);
|
||||
rtrim (name);
|
||||
if (name.empty()) {
|
||||
ctx.editor.SetStatus("theme: provide a name (e.g., nord, solarized-dark, gruvbox-light, eink)");
|
||||
return true;
|
||||
}
|
||||
kte::gThemeChangeRequest = name;
|
||||
kte::gThemeChangePending = true;
|
||||
ctx.editor.SetStatus(std::string("Theme requested: ") + name);
|
||||
kte::gThemeChangeRequest= name;
|
||||
kte::gThemeChangePending=true;
|
||||
ctx.editor.SetStatus (std::string("Theme requested: ") + name);
|
||||
return true;
|
||||
# else
|
||||
(void) ctx;
|
||||
// No-op in terminal build
|
||||
(void) ctx;
|
||||
// No-op in terminal build
|
||||
return true;
|
||||
# endif
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ ImGuiInputHandler::ProcessSDLEvent(const SDL_Event &e)
|
||||
// High-resolution trackpads can deliver fractional wheel deltas. Accumulate
|
||||
// precise values and emit one scroll step per whole unit.
|
||||
float dy = 0.0f;
|
||||
#if SDL_VERSION_ATLEAST(2,0,18)
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 18)
|
||||
dy = e.wheel.preciseY;
|
||||
#else
|
||||
dy = static_cast<float>(e.wheel.y);
|
||||
@@ -439,14 +439,12 @@ ImGuiInputHandler::ProcessSDLEvent(const SDL_Event &e)
|
||||
}
|
||||
|
||||
// If editor universal argument is active, consume digit TEXTINPUT
|
||||
if (ed_ &&ed_
|
||||
|
||||
if (ed_ && ed_
|
||||
|
||||
|
||||
->
|
||||
UArg() != 0
|
||||
)
|
||||
{
|
||||
) {
|
||||
const char *txt = e.text.text;
|
||||
if (txt && *txt) {
|
||||
unsigned char c0 = static_cast<unsigned char>(txt[0]);
|
||||
|
||||
@@ -283,12 +283,11 @@ QtInputHandler::ProcessKeyEvent(const QKeyEvent &e)
|
||||
const bool ctrl_like = (mods & Qt::ControlModifier);
|
||||
|
||||
// 1) Universal argument digits (when active), consume digits without enqueuing commands
|
||||
if (ed_ &&ed_
|
||||
if (ed_ && ed_
|
||||
|
||||
->
|
||||
UArg() != 0
|
||||
)
|
||||
{
|
||||
) {
|
||||
if (!(mods & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier))) {
|
||||
if (e.key() >= Qt::Key_0 && e.key() <= Qt::Key_9) {
|
||||
int d = e.key() - Qt::Key_0;
|
||||
@@ -379,10 +378,9 @@ QtInputHandler::ProcessKeyEvent(const QKeyEvent &e)
|
||||
// ESC/meta chords: on macOS, do NOT treat Meta as ESC; only Alt (Option) should trigger.
|
||||
#if defined(__APPLE__)
|
||||
if (esc_meta_ || (mods & Qt::AltModifier)) {
|
||||
|
||||
|
||||
#else
|
||||
if (esc_meta_ || (mods & (Qt::AltModifier | Qt::MetaModifier))) {
|
||||
|
||||
#endif
|
||||
int ascii_key = 0;
|
||||
if (e.key() == Qt::Key_Backspace) {
|
||||
|
||||
25727
fonts/Go.h
25727
fonts/Go.h
File diff suppressed because it is too large
Load Diff
22055
fonts/Triplicate.h
22055
fonts/Triplicate.h
File diff suppressed because it is too large
Load Diff
1
main.cc
1
main.cc
@@ -195,7 +195,6 @@ main(int argc, char *argv[])
|
||||
} else if (req_term) {
|
||||
use_gui = false;
|
||||
} else {
|
||||
|
||||
// Default depends on build target: kge defaults to GUI, kte to terminal
|
||||
#if defined(KTE_DEFAULT_GUI)
|
||||
use_gui = true;
|
||||
|
||||
@@ -44,7 +44,7 @@ CreateTreeSitterHighlighter(const char *filetype,
|
||||
const void * (*get_lang)())
|
||||
{
|
||||
const auto *lang = reinterpret_cast<const TSLanguage *>(get_lang ? get_lang() : nullptr);
|
||||
return std::make_unique < TreeSitterHighlighter > (lang, filetype ? std::string(filetype) : std::string());
|
||||
return std::make_unique<TreeSitterHighlighter>(lang, filetype ? std::string(filetype) : std::string());
|
||||
}
|
||||
} // namespace kte
|
||||
|
||||
|
||||
26
tests/Test.h
26
tests/Test.h
@@ -8,19 +8,23 @@
|
||||
#include <sstream>
|
||||
|
||||
namespace ktet {
|
||||
|
||||
struct TestCase {
|
||||
std::string name;
|
||||
std::function<void()> fn;
|
||||
};
|
||||
|
||||
inline std::vector<TestCase>& registry() {
|
||||
|
||||
inline std::vector<TestCase> &
|
||||
registry()
|
||||
{
|
||||
static std::vector<TestCase> r;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
struct Registrar {
|
||||
Registrar(const char* name, std::function<void()> fn) {
|
||||
Registrar(const char *name, std::function<void()> fn)
|
||||
{
|
||||
registry().push_back(TestCase{std::string(name), std::move(fn)});
|
||||
}
|
||||
};
|
||||
@@ -30,27 +34,35 @@ struct AssertionFailure {
|
||||
std::string msg;
|
||||
};
|
||||
|
||||
inline void expect(bool cond, const char* expr, const char* file, int line) {
|
||||
|
||||
inline void
|
||||
expect(bool cond, const char *expr, const char *file, int line)
|
||||
{
|
||||
if (!cond) {
|
||||
std::cerr << file << ":" << line << ": EXPECT failed: " << expr << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
inline void assert_true(bool cond, const char* expr, const char* file, int line) {
|
||||
|
||||
inline void
|
||||
assert_true(bool cond, const char *expr, const char *file, int line)
|
||||
{
|
||||
if (!cond) {
|
||||
throw AssertionFailure{std::string(file) + ":" + std::to_string(line) + ": ASSERT failed: " + expr};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename A, typename B>
|
||||
inline void assert_eq_impl(const A& a, const B& b, const char* ea, const char* eb, const char* file, int line) {
|
||||
inline void
|
||||
assert_eq_impl(const A &a, const B &b, const char *ea, const char *eb, const char *file, int line)
|
||||
{
|
||||
if (!(a == b)) {
|
||||
std::ostringstream oss;
|
||||
oss << file << ":" << line << ": ASSERT_EQ failed: " << ea << " == " << eb;
|
||||
throw AssertionFailure{oss.str()};
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ktet
|
||||
|
||||
#define TEST(name) \
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
|
||||
int main() {
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace std::chrono;
|
||||
auto ® = ktet::registry();
|
||||
std::cout << "kte unit tests: " << reg.size() << " test(s)\n";
|
||||
int failed = 0;
|
||||
auto t0 = steady_clock::now();
|
||||
for (const auto &tc : reg) {
|
||||
for (const auto &tc: reg) {
|
||||
auto ts = steady_clock::now();
|
||||
try {
|
||||
tc.fn();
|
||||
|
||||
@@ -4,12 +4,17 @@
|
||||
#include <string>
|
||||
#include "Buffer.h"
|
||||
|
||||
static std::string read_all(const std::string &path) {
|
||||
|
||||
static std::string
|
||||
read_all(const std::string &path)
|
||||
{
|
||||
std::ifstream in(path, std::ios::binary);
|
||||
return std::string((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>());
|
||||
}
|
||||
|
||||
TEST(Buffer_SaveAs_and_Save_new_file) {
|
||||
|
||||
TEST(Buffer_SaveAs_and_Save_new_file)
|
||||
{
|
||||
const std::string path = "./.kte_ut_buffer_io_1.tmp";
|
||||
std::remove(path.c_str());
|
||||
|
||||
@@ -34,7 +39,9 @@ TEST(Buffer_SaveAs_and_Save_new_file) {
|
||||
std::remove(path.c_str());
|
||||
}
|
||||
|
||||
TEST(Buffer_Save_after_Open_existing) {
|
||||
|
||||
TEST(Buffer_Save_after_Open_existing)
|
||||
{
|
||||
const std::string path = "./.kte_ut_buffer_io_2.tmp";
|
||||
std::remove(path.c_str());
|
||||
{
|
||||
@@ -57,7 +64,9 @@ TEST(Buffer_Save_after_Open_existing) {
|
||||
std::remove(path.c_str());
|
||||
}
|
||||
|
||||
TEST(Buffer_Open_nonexistent_then_SaveAs) {
|
||||
|
||||
TEST(Buffer_Open_nonexistent_then_SaveAs)
|
||||
{
|
||||
const std::string path = "./.kte_ut_buffer_io_3.tmp";
|
||||
std::remove(path.c_str());
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ check_buffer_matches_model(const Buffer &b, const std::string &model)
|
||||
}
|
||||
|
||||
|
||||
TEST (Buffer_RowsCache_MultiLineEdits_StayConsistent)
|
||||
TEST(Buffer_RowsCache_MultiLineEdits_StayConsistent)
|
||||
{
|
||||
Buffer b;
|
||||
std::string model;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
using ktet::TestHarness;
|
||||
|
||||
|
||||
TEST (CommandSemantics_KillToEOL_KillChain_And_Yank)
|
||||
TEST(CommandSemantics_KillToEOL_KillChain_And_Yank)
|
||||
{
|
||||
TestHarness h;
|
||||
Editor &ed = h.EditorRef();
|
||||
@@ -34,7 +34,7 @@ TEST (CommandSemantics_KillToEOL_KillChain_And_Yank)
|
||||
}
|
||||
|
||||
|
||||
TEST (CommandSemantics_ToggleMark_JumpToMark)
|
||||
TEST(CommandSemantics_ToggleMark_JumpToMark)
|
||||
{
|
||||
TestHarness h;
|
||||
Buffer &b = h.Buf();
|
||||
@@ -59,7 +59,7 @@ TEST (CommandSemantics_ToggleMark_JumpToMark)
|
||||
}
|
||||
|
||||
|
||||
TEST (CommandSemantics_CtrlGRefresh_ClearsMark_WhenNothingElseToCancel)
|
||||
TEST(CommandSemantics_CtrlGRefresh_ClearsMark_WhenNothingElseToCancel)
|
||||
{
|
||||
TestHarness h;
|
||||
Buffer &b = h.Buf();
|
||||
@@ -78,7 +78,7 @@ TEST (CommandSemantics_CtrlGRefresh_ClearsMark_WhenNothingElseToCancel)
|
||||
}
|
||||
|
||||
|
||||
TEST (CommandSemantics_CopyRegion_And_KillRegion)
|
||||
TEST(CommandSemantics_CopyRegion_And_KillRegion)
|
||||
{
|
||||
TestHarness h;
|
||||
Editor &ed = h.EditorRef();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "tests/TestHarness.h"
|
||||
|
||||
|
||||
TEST (DailyDriverHarness_Smoke_CanCreateBufferAndInsertText)
|
||||
TEST(DailyDriverHarness_Smoke_CanCreateBufferAndInsertText)
|
||||
{
|
||||
ktet::TestHarness h;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ buffer_bytes_via_views(const Buffer &b)
|
||||
}
|
||||
|
||||
|
||||
TEST (DailyWorkflow_OpenEditSave_Transcript)
|
||||
TEST(DailyWorkflow_OpenEditSave_Transcript)
|
||||
{
|
||||
ktet::InstallDefaultCommandsOnce();
|
||||
|
||||
@@ -77,7 +77,7 @@ TEST (DailyWorkflow_OpenEditSave_Transcript)
|
||||
}
|
||||
|
||||
|
||||
TEST (DailyWorkflow_MultiBufferSwitchClose_Transcript)
|
||||
TEST(DailyWorkflow_MultiBufferSwitchClose_Transcript)
|
||||
{
|
||||
ktet::InstallDefaultCommandsOnce();
|
||||
|
||||
@@ -123,7 +123,7 @@ TEST (DailyWorkflow_MultiBufferSwitchClose_Transcript)
|
||||
}
|
||||
|
||||
|
||||
TEST (DailyWorkflow_CrashRecovery_SwapReplay_Transcript)
|
||||
TEST(DailyWorkflow_CrashRecovery_SwapReplay_Transcript)
|
||||
{
|
||||
ktet::InstallDefaultCommandsOnce();
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <ncurses.h>
|
||||
|
||||
|
||||
TEST (KKeymap_KPrefix_CanonicalChords)
|
||||
TEST(KKeymap_KPrefix_CanonicalChords)
|
||||
{
|
||||
CommandId id{};
|
||||
|
||||
@@ -37,7 +37,7 @@ TEST (KKeymap_KPrefix_CanonicalChords)
|
||||
}
|
||||
|
||||
|
||||
TEST (KKeymap_CtrlChords_CanonicalChords)
|
||||
TEST(KKeymap_CtrlChords_CanonicalChords)
|
||||
{
|
||||
CommandId id{};
|
||||
|
||||
@@ -60,7 +60,7 @@ TEST (KKeymap_CtrlChords_CanonicalChords)
|
||||
}
|
||||
|
||||
|
||||
TEST (KKeymap_EscChords_CanonicalChords)
|
||||
TEST(KKeymap_EscChords_CanonicalChords)
|
||||
{
|
||||
CommandId id{};
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ LineContentFor(const std::string &s, std::size_t line_num)
|
||||
}
|
||||
|
||||
|
||||
TEST (PieceTable_Insert_Delete_LineCount)
|
||||
TEST(PieceTable_Insert_Delete_LineCount)
|
||||
{
|
||||
PieceTable pt;
|
||||
// start empty
|
||||
@@ -61,7 +61,7 @@ TEST (PieceTable_Insert_Delete_LineCount)
|
||||
}
|
||||
|
||||
|
||||
TEST (PieceTable_LineCol_Conversions)
|
||||
TEST(PieceTable_LineCol_Conversions)
|
||||
{
|
||||
PieceTable pt;
|
||||
std::string s = "hello\nworld\n"; // two lines with trailing NL
|
||||
@@ -84,7 +84,7 @@ TEST (PieceTable_LineCol_Conversions)
|
||||
}
|
||||
|
||||
|
||||
TEST (PieceTable_ReferenceModel_RandomEdits_Deterministic)
|
||||
TEST(PieceTable_ReferenceModel_RandomEdits_Deterministic)
|
||||
{
|
||||
PieceTable pt;
|
||||
std::string model;
|
||||
|
||||
@@ -20,7 +20,7 @@ to_string_rows(const Buffer &buf)
|
||||
}
|
||||
|
||||
|
||||
TEST (ReflowParagraph_IndentedBullets_PreserveStructure)
|
||||
TEST(ReflowParagraph_IndentedBullets_PreserveStructure)
|
||||
{
|
||||
InstallDefaultCommands();
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ to_string_rows(const Buffer &buf)
|
||||
}
|
||||
|
||||
|
||||
TEST (ReflowParagraph_NumberedList_HangingIndent)
|
||||
TEST(ReflowParagraph_NumberedList_HangingIndent)
|
||||
{
|
||||
InstallDefaultCommands();
|
||||
|
||||
|
||||
@@ -3,22 +3,32 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
static std::vector<std::size_t> ref_find_all(const std::string &text, const std::string &pat) {
|
||||
|
||||
static std::vector<std::size_t>
|
||||
ref_find_all(const std::string &text, const std::string &pat)
|
||||
{
|
||||
std::vector<std::size_t> res;
|
||||
if (pat.empty()) return res;
|
||||
if (pat.empty())
|
||||
return res;
|
||||
std::size_t from = 0;
|
||||
while (true) {
|
||||
auto p = text.find(pat, from);
|
||||
if (p == std::string::npos) break;
|
||||
if (p == std::string::npos)
|
||||
break;
|
||||
res.push_back(p);
|
||||
from = p + pat.size();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
TEST(OptimizedSearch_basic_cases) {
|
||||
|
||||
TEST(OptimizedSearch_basic_cases)
|
||||
{
|
||||
OptimizedSearch os;
|
||||
struct Case { std::string text; std::string pat; } cases[] = {
|
||||
struct Case {
|
||||
std::string text;
|
||||
std::string pat;
|
||||
} cases[] = {
|
||||
{"", ""},
|
||||
{"", "a"},
|
||||
{"a", ""},
|
||||
@@ -28,7 +38,7 @@ TEST(OptimizedSearch_basic_cases) {
|
||||
{"abcabcabc", "abc"},
|
||||
{"the quick brown fox", "fox"},
|
||||
};
|
||||
for (auto &c : cases) {
|
||||
for (auto &c: cases) {
|
||||
auto got = os.find_all(c.text, c.pat, 0);
|
||||
auto ref = ref_find_all(c.text, c.pat);
|
||||
ASSERT_EQ(got, ref);
|
||||
|
||||
@@ -7,7 +7,7 @@ using ktet::TestHarness;
|
||||
// These tests intentionally drive the prompt-based search/replace UI headlessly
|
||||
// via `Execute(Editor&, CommandId, ...)` to lock down behavior without ncurses.
|
||||
|
||||
TEST (SearchFlow_FindStart_Success_LeavesCursorOnMatch_And_ClearsSearchState)
|
||||
TEST(SearchFlow_FindStart_Success_LeavesCursorOnMatch_And_ClearsSearchState)
|
||||
{
|
||||
TestHarness h;
|
||||
Editor &ed = h.EditorRef();
|
||||
@@ -39,7 +39,7 @@ TEST (SearchFlow_FindStart_Success_LeavesCursorOnMatch_And_ClearsSearchState)
|
||||
}
|
||||
|
||||
|
||||
TEST (SearchFlow_FindStart_NotFound_RestoresOrigin_And_ClearsSearchState)
|
||||
TEST(SearchFlow_FindStart_NotFound_RestoresOrigin_And_ClearsSearchState)
|
||||
{
|
||||
TestHarness h;
|
||||
Editor &ed = h.EditorRef();
|
||||
@@ -71,7 +71,7 @@ TEST (SearchFlow_FindStart_NotFound_RestoresOrigin_And_ClearsSearchState)
|
||||
}
|
||||
|
||||
|
||||
TEST (SearchFlow_SearchReplace_EmptyFind_DoesNotMutateBuffer_And_ClearsState)
|
||||
TEST(SearchFlow_SearchReplace_EmptyFind_DoesNotMutateBuffer_And_ClearsState)
|
||||
{
|
||||
TestHarness h;
|
||||
Editor &ed = h.EditorRef();
|
||||
@@ -101,7 +101,7 @@ TEST (SearchFlow_SearchReplace_EmptyFind_DoesNotMutateBuffer_And_ClearsState)
|
||||
}
|
||||
|
||||
|
||||
TEST (SearchFlow_RegexFind_InvalidPattern_FailsSafely_And_ClearsStateOnEnter)
|
||||
TEST(SearchFlow_RegexFind_InvalidPattern_FailsSafely_And_ClearsStateOnEnter)
|
||||
{
|
||||
TestHarness h;
|
||||
Editor &ed = h.EditorRef();
|
||||
|
||||
@@ -23,7 +23,7 @@ write_file_bytes(const std::string &path, const std::string &bytes)
|
||||
}
|
||||
|
||||
|
||||
TEST (SwapCleanup_ResetJournalOnSave)
|
||||
TEST(SwapCleanup_ResetJournalOnSave)
|
||||
{
|
||||
ktet::InstallDefaultCommandsOnce();
|
||||
|
||||
@@ -82,7 +82,7 @@ TEST (SwapCleanup_ResetJournalOnSave)
|
||||
}
|
||||
|
||||
|
||||
TEST (SwapCleanup_PruneSwapDir_ByAge)
|
||||
TEST(SwapCleanup_PruneSwapDir_ByAge)
|
||||
{
|
||||
const fs::path xdg_root = fs::temp_directory_path() /
|
||||
(std::string("kte_ut_xdg_state_swap_prune_") + std::to_string((int) ::getpid()));
|
||||
|
||||
@@ -25,7 +25,7 @@ write_file_bytes(const std::string &path, const std::string &bytes)
|
||||
|
||||
// Simulate git editor workflow: open file, edit, save, edit more, close.
|
||||
// The swap file should be deleted on close, not left behind.
|
||||
TEST (SwapCleanup_GitEditorWorkflow)
|
||||
TEST(SwapCleanup_GitEditorWorkflow)
|
||||
{
|
||||
ktet::InstallDefaultCommandsOnce();
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
} // namespace
|
||||
|
||||
|
||||
TEST (SwapRecorder_InsertABC)
|
||||
TEST(SwapRecorder_InsertABC)
|
||||
{
|
||||
Buffer b;
|
||||
FakeSwapRecorder rec;
|
||||
@@ -66,7 +66,7 @@ TEST (SwapRecorder_InsertABC)
|
||||
}
|
||||
|
||||
|
||||
TEST (SwapRecorder_InsertNewline)
|
||||
TEST(SwapRecorder_InsertNewline)
|
||||
{
|
||||
Buffer b;
|
||||
FakeSwapRecorder rec;
|
||||
@@ -82,7 +82,7 @@ TEST (SwapRecorder_InsertNewline)
|
||||
}
|
||||
|
||||
|
||||
TEST (SwapRecorder_DeleteSpanningNewline)
|
||||
TEST(SwapRecorder_DeleteSpanningNewline)
|
||||
{
|
||||
Buffer b;
|
||||
// Prepare content without a recorder (should be no-op)
|
||||
|
||||
@@ -71,7 +71,7 @@ struct ScopedXdgStateHome {
|
||||
} // namespace
|
||||
|
||||
|
||||
TEST (SwapRecoveryPrompt_Recover_ReplaysSwap)
|
||||
TEST(SwapRecoveryPrompt_Recover_ReplaysSwap)
|
||||
{
|
||||
ktet::InstallDefaultCommandsOnce();
|
||||
|
||||
@@ -127,7 +127,7 @@ TEST (SwapRecoveryPrompt_Recover_ReplaysSwap)
|
||||
}
|
||||
|
||||
|
||||
TEST (SwapRecoveryPrompt_Discard_DeletesSwapAndOpensClean)
|
||||
TEST(SwapRecoveryPrompt_Discard_DeletesSwapAndOpensClean)
|
||||
{
|
||||
ktet::InstallDefaultCommandsOnce();
|
||||
|
||||
@@ -178,7 +178,7 @@ TEST (SwapRecoveryPrompt_Discard_DeletesSwapAndOpensClean)
|
||||
}
|
||||
|
||||
|
||||
TEST (SwapRecoveryPrompt_Cancel_AbortsOpen)
|
||||
TEST(SwapRecoveryPrompt_Cancel_AbortsOpen)
|
||||
{
|
||||
ktet::InstallDefaultCommandsOnce();
|
||||
|
||||
@@ -228,7 +228,7 @@ TEST (SwapRecoveryPrompt_Cancel_AbortsOpen)
|
||||
}
|
||||
|
||||
|
||||
TEST (SwapRecoveryPrompt_CorruptSwap_OffersDelete)
|
||||
TEST(SwapRecoveryPrompt_CorruptSwap_OffersDelete)
|
||||
{
|
||||
ktet::InstallDefaultCommandsOnce();
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ record_types_from_bytes(const std::string &bytes)
|
||||
}
|
||||
|
||||
|
||||
TEST (SwapReplay_RecordFlushReopenReplay_ExactBytesMatch)
|
||||
TEST(SwapReplay_RecordFlushReopenReplay_ExactBytesMatch)
|
||||
{
|
||||
const std::string path = "./.kte_ut_swap_replay_1.txt";
|
||||
std::remove(path.c_str());
|
||||
@@ -103,7 +103,7 @@ TEST (SwapReplay_RecordFlushReopenReplay_ExactBytesMatch)
|
||||
}
|
||||
|
||||
|
||||
TEST (SwapReplay_TruncatedLog_FailsSafely)
|
||||
TEST(SwapReplay_TruncatedLog_FailsSafely)
|
||||
{
|
||||
const std::string path = "./.kte_ut_swap_replay_2.txt";
|
||||
std::remove(path.c_str());
|
||||
@@ -140,7 +140,7 @@ TEST (SwapReplay_TruncatedLog_FailsSafely)
|
||||
}
|
||||
|
||||
|
||||
TEST (SwapReplay_Checkpoint_Midstream_ExactBytesMatch)
|
||||
TEST(SwapReplay_Checkpoint_Midstream_ExactBytesMatch)
|
||||
{
|
||||
const std::string path = "./.kte_ut_swap_replay_chkpt_1.txt";
|
||||
std::remove(path.c_str());
|
||||
@@ -177,7 +177,7 @@ TEST (SwapReplay_Checkpoint_Midstream_ExactBytesMatch)
|
||||
}
|
||||
|
||||
|
||||
TEST (SwapCompaction_RewritesToSingleCheckpoint)
|
||||
TEST(SwapCompaction_RewritesToSingleCheckpoint)
|
||||
{
|
||||
const std::string path = "./.kte_ut_swap_compact_1.txt";
|
||||
std::remove(path.c_str());
|
||||
|
||||
@@ -65,7 +65,7 @@ crc32(const std::uint8_t *data, std::size_t len, std::uint32_t seed = 0)
|
||||
} // namespace
|
||||
|
||||
|
||||
TEST (SwapWriter_Header_Records_And_CRC)
|
||||
TEST(SwapWriter_Header_Records_And_CRC)
|
||||
{
|
||||
const std::filesystem::path xdg_root = std::filesystem::temp_directory_path() /
|
||||
(std::string("kte_ut_xdg_state_") + std::to_string((int) ::getpid()));
|
||||
@@ -166,7 +166,7 @@ TEST (SwapWriter_Header_Records_And_CRC)
|
||||
}
|
||||
|
||||
|
||||
TEST (SwapWriter_NoStomp_SameBasename)
|
||||
TEST(SwapWriter_NoStomp_SameBasename)
|
||||
{
|
||||
const std::filesystem::path xdg_root = std::filesystem::temp_directory_path() /
|
||||
(std::string("kte_ut_xdg_state_nostomp_") + std::to_string(
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#if defined(KTE_TESTS)
|
||||
#include <unordered_set>
|
||||
|
||||
|
||||
static void
|
||||
validate_undo_subtree(const UndoNode *node, const UndoNode *expected_parent,
|
||||
std::unordered_set<const UndoNode *> &seen)
|
||||
@@ -56,7 +57,7 @@ validate_undo_tree(const UndoSystem &u)
|
||||
// The undo suite aims to cover invariants with a small, adversarial test matrix.
|
||||
|
||||
|
||||
TEST (Undo_InsertRun_Coalesces_OneStep)
|
||||
TEST(Undo_InsertRun_Coalesces_OneStep)
|
||||
{
|
||||
Buffer b;
|
||||
UndoSystem *u = b.Undo();
|
||||
@@ -80,7 +81,7 @@ TEST (Undo_InsertRun_Coalesces_OneStep)
|
||||
}
|
||||
|
||||
|
||||
TEST (Undo_InsertRun_BreaksOnNonAdjacentCursor)
|
||||
TEST(Undo_InsertRun_BreaksOnNonAdjacentCursor)
|
||||
{
|
||||
Buffer b;
|
||||
UndoSystem *u = b.Undo();
|
||||
@@ -108,7 +109,7 @@ TEST (Undo_InsertRun_BreaksOnNonAdjacentCursor)
|
||||
}
|
||||
|
||||
|
||||
TEST (Undo_BackspaceRun_Coalesces_OneStep)
|
||||
TEST(Undo_BackspaceRun_Coalesces_OneStep)
|
||||
{
|
||||
Buffer b;
|
||||
UndoSystem *u = b.Undo();
|
||||
@@ -142,7 +143,7 @@ TEST (Undo_BackspaceRun_Coalesces_OneStep)
|
||||
}
|
||||
|
||||
|
||||
TEST (Undo_DeleteKeyRun_Coalesces_OneStep)
|
||||
TEST(Undo_DeleteKeyRun_Coalesces_OneStep)
|
||||
{
|
||||
Buffer b;
|
||||
UndoSystem *u = b.Undo();
|
||||
@@ -175,7 +176,7 @@ TEST (Undo_DeleteKeyRun_Coalesces_OneStep)
|
||||
}
|
||||
|
||||
|
||||
TEST (Undo_Newline_IsStandalone)
|
||||
TEST(Undo_Newline_IsStandalone)
|
||||
{
|
||||
Buffer b;
|
||||
UndoSystem *u = b.Undo();
|
||||
@@ -210,7 +211,7 @@ TEST (Undo_Newline_IsStandalone)
|
||||
}
|
||||
|
||||
|
||||
TEST (Undo_ExplicitGroup_UndoesAsUnit)
|
||||
TEST(Undo_ExplicitGroup_UndoesAsUnit)
|
||||
{
|
||||
Buffer b;
|
||||
UndoSystem *u = b.Undo();
|
||||
@@ -238,7 +239,7 @@ TEST (Undo_ExplicitGroup_UndoesAsUnit)
|
||||
}
|
||||
|
||||
|
||||
TEST (Undo_Branching_RedoBranchSelectionDeterministic)
|
||||
TEST(Undo_Branching_RedoBranchSelectionDeterministic)
|
||||
{
|
||||
Buffer b;
|
||||
UndoSystem *u = b.Undo();
|
||||
@@ -282,7 +283,7 @@ TEST (Undo_Branching_RedoBranchSelectionDeterministic)
|
||||
}
|
||||
|
||||
|
||||
TEST (Undo_DirtyFlag_CrossesMarkSaved)
|
||||
TEST(Undo_DirtyFlag_CrossesMarkSaved)
|
||||
{
|
||||
Buffer b;
|
||||
UndoSystem *u = b.Undo();
|
||||
@@ -311,7 +312,7 @@ TEST (Undo_DirtyFlag_CrossesMarkSaved)
|
||||
}
|
||||
|
||||
|
||||
TEST (Undo_RoundTrip_Lossless_RandomEdits)
|
||||
TEST(Undo_RoundTrip_Lossless_RandomEdits)
|
||||
{
|
||||
Buffer b;
|
||||
UndoSystem *u = b.Undo();
|
||||
|
||||
@@ -33,7 +33,7 @@ dump_bytes(const std::string &s)
|
||||
}
|
||||
|
||||
|
||||
TEST (VisualLineMode_BroadcastInsert)
|
||||
TEST(VisualLineMode_BroadcastInsert)
|
||||
{
|
||||
InstallDefaultCommands();
|
||||
|
||||
@@ -65,7 +65,7 @@ TEST (VisualLineMode_BroadcastInsert)
|
||||
}
|
||||
|
||||
|
||||
TEST (VisualLineMode_BroadcastInsert_UndoRedo)
|
||||
TEST(VisualLineMode_BroadcastInsert_UndoRedo)
|
||||
{
|
||||
InstallDefaultCommands();
|
||||
|
||||
@@ -108,7 +108,7 @@ TEST (VisualLineMode_BroadcastInsert_UndoRedo)
|
||||
}
|
||||
|
||||
|
||||
TEST (VisualLineMode_BroadcastBackspace)
|
||||
TEST(VisualLineMode_BroadcastBackspace)
|
||||
{
|
||||
InstallDefaultCommands();
|
||||
|
||||
@@ -135,7 +135,7 @@ TEST (VisualLineMode_BroadcastBackspace)
|
||||
}
|
||||
|
||||
|
||||
TEST (VisualLineMode_BroadcastBackspace_UndoRedo)
|
||||
TEST(VisualLineMode_BroadcastBackspace_UndoRedo)
|
||||
{
|
||||
InstallDefaultCommands();
|
||||
|
||||
@@ -175,7 +175,7 @@ TEST (VisualLineMode_BroadcastBackspace_UndoRedo)
|
||||
}
|
||||
|
||||
|
||||
TEST (VisualLineMode_CancelWithCtrlG)
|
||||
TEST(VisualLineMode_CancelWithCtrlG)
|
||||
{
|
||||
InstallDefaultCommands();
|
||||
|
||||
@@ -208,7 +208,7 @@ TEST (VisualLineMode_CancelWithCtrlG)
|
||||
}
|
||||
|
||||
|
||||
TEST (Yank_ClearsMarkAndVisualLine)
|
||||
TEST(Yank_ClearsMarkAndVisualLine)
|
||||
{
|
||||
InstallDefaultCommands();
|
||||
|
||||
@@ -241,7 +241,7 @@ TEST (Yank_ClearsMarkAndVisualLine)
|
||||
}
|
||||
|
||||
|
||||
TEST (VisualLineMode_Yank_BroadcastsToBOL_AndUndo)
|
||||
TEST(VisualLineMode_Yank_BroadcastsToBOL_AndUndo)
|
||||
{
|
||||
InstallDefaultCommands();
|
||||
|
||||
@@ -298,7 +298,7 @@ TEST (VisualLineMode_Yank_BroadcastsToBOL_AndUndo)
|
||||
}
|
||||
|
||||
|
||||
TEST (VisualLineMode_Highlight_IsPerLineCursorSpot)
|
||||
TEST(VisualLineMode_Highlight_IsPerLineCursorSpot)
|
||||
{
|
||||
Buffer b;
|
||||
// Note: buffers that end with a trailing '\n' have an extra empty row.
|
||||
|
||||
Reference in New Issue
Block a user