Release v0.2.0 with incident diagnostics and in-app log viewer
This commit is contained in:
@@ -44,7 +44,37 @@ int main(int argc, char **argv)
|
||||
}
|
||||
try
|
||||
{
|
||||
require(ks::diagnosticText(L"word") == L"\"word\" units=4 truncated=0",
|
||||
"diagnostic word preserved");
|
||||
require(ks::diagnosticText(L"\"\\\n\r\t") ==
|
||||
L"\"\\\"\\\\\\u000a\\u000d\\u0009\" units=5 truncated=0",
|
||||
"diagnostic control characters cannot create log lines");
|
||||
require(ks::diagnosticText(L"\u0457\u200b") == L"\"\\u0457\\u200b\" units=2 truncated=0",
|
||||
"diagnostic unicode and invisible characters preserved exactly");
|
||||
require(ks::diagnosticText(std::wstring(513, L'a')).find(L"units=513 truncated=1") != std::wstring::npos,
|
||||
"large diagnostic selections are explicitly truncated");
|
||||
STARTUPINFOW startup{sizeof(startup)};
|
||||
ks::DiagnosticBuffer diagnostics;
|
||||
require(diagnostics.record(L"successful-attempt", false, 100).empty(),
|
||||
"successful diagnostics stay in memory");
|
||||
auto incident = diagnostics.record(L"failed-attempt", true, 200);
|
||||
require(incident.find(L"successful-attempt") != std::wstring::npos &&
|
||||
incident.find(L"failed-attempt") != std::wstring::npos,
|
||||
"incident includes preceding successful context");
|
||||
require(diagnostics.record(L"next-failure", true, 300).find(L"successful-attempt") == std::wstring::npos,
|
||||
"flushed context is not duplicated");
|
||||
diagnostics.record(L"expired-context", false, 400);
|
||||
require(diagnostics.record(L"later-failure", true, 30500).find(L"expired-context") == std::wstring::npos,
|
||||
"context expires after thirty seconds");
|
||||
diagnostics.record(L"oldest-context", false, 30600);
|
||||
for (int i = 0; i < 40; ++i)
|
||||
diagnostics.record(L"bounded-context", false, 30600 + i);
|
||||
require(diagnostics.record(L"bounded-failure", true, 30700).find(L"oldest-context") == std::wstring::npos,
|
||||
"context buffer has a fixed size");
|
||||
diagnostics.record(L"disabled-context", false, 30800);
|
||||
diagnostics.clear();
|
||||
require(diagnostics.record(L"new-failure", true, 30900).find(L"disabled-context") == std::wstring::npos,
|
||||
"clearing diagnostics discards sensitive context");
|
||||
startup.dwFlags = STARTF_USESHOWWINDOW;
|
||||
startup.wShowWindow = SW_HIDE;
|
||||
PROCESS_INFORMATION child{};
|
||||
@@ -346,6 +376,7 @@ int main(int argc, char **argv)
|
||||
require(history.entries().size() == 2, "a new screenshot is retained");
|
||||
}
|
||||
ks::Settings settings;
|
||||
settings.writeLog = false;
|
||||
settings.elevatedAutostart = true;
|
||||
settings.autoCorrect = true;
|
||||
settings.autoMaxRank = 10000;
|
||||
@@ -358,6 +389,9 @@ int main(int argc, char **argv)
|
||||
settings.snippets = {{L";address", L"Line 1\r\n{cursor}Line 2"}};
|
||||
ks::saveSettings(temp / L"settings.json", settings);
|
||||
auto restored = ks::loadSettings(temp / L"settings.json", {});
|
||||
require(!restored.writeLog, "logging setting persists when disabled");
|
||||
require(ks::loadSettings(temp / L"defaults.json", {}).writeLog,
|
||||
"logging defaults on for existing diagnostic installations");
|
||||
require(restored.snippets[0].text == settings.snippets[0].text, "settings snippet roundtrip");
|
||||
require(restored.cycle == settings.cycle, "layout order roundtrip");
|
||||
require(restored.elevatedAutostart, "elevated autostart setting roundtrip");
|
||||
|
||||
Reference in New Issue
Block a user