cleanup, docs

This commit is contained in:
root
2026-06-16 12:21:31 +00:00
parent dff1959341
commit ea08d5f28b
296 changed files with 1571 additions and 1940 deletions
+50
View File
@@ -152,6 +152,53 @@ void cli_run_demo_smoke()
cli_expect_http("uce_demo_smoke:demo page " + file, "/demo/" + file, 200, "", file == "unit-browser.uce" ? StringList() : cli_demo_error_markers());
}
bool cli_doc_source_has_example(String source)
{
for(String line : split(source, "\n"))
if(trim(line) == ":example")
return(true);
return(false);
}
void cli_run_doc_pages_gate()
{
StringList error_markers;
error_markers.push_back("doc example error");
error_markers.push_back(String("uce compile ") + "error");
error_markers.push_back(String("wasm runtime error during ") + "request");
error_markers.push_back(String("fatal signal during ") + "request");
error_markers.push_back(String("uncaught exception during ") + "request");
error_markers.push_back("timed out acquiring compile lock");
for(String file_name : ls("../doc/pages/"))
{
String page = nibble(file_name, ".");
if(page == "")
continue;
String source = file_get_contents("../doc/pages/" + file_name);
bool has_example = cli_doc_source_has_example(source);
String path = "/doc/index.uce?p=" + uri_encode(page);
CliHttpResponse res = cli_frontend(path);
String summary;
bool ok = cli_expect_http_once(res, path, 200, "doc-detail", error_markers, summary);
String lower = to_lower(res.body);
if(has_example)
{
if(!cli_contains(res.body, "class=\"example-output\"") || !cli_contains(res.body, "example-output-label\">Output"))
{
ok = false;
summary += "; missing example Output block";
}
if(cli_contains(lower, "doc example error"))
{
ok = false;
summary += "; example reported an error";
}
}
cli_test_case("uce_doc_gate:doc page " + page, ok, ok ? summary : summary + "; body=" + cli_truncate(res.body));
}
}
void cli_run_http_smoke()
{
cli_expect_http("uce_http_smoke:doc index", "/doc/index.uce", 200, "<html>");
@@ -333,6 +380,9 @@ CLI(Request& context)
cli_run_site_suite();
print("[GROUP] site ", std::to_string((u64)((time_precise() - group_start) * 1000)), " ms\n");
group_start = time_precise();
cli_run_doc_pages_gate();
print("[GROUP] doc-gate ", std::to_string((u64)((time_precise() - group_start) * 1000)), " ms\n");
group_start = time_precise();
cli_run_security_smoke();
print("[GROUP] security ", std::to_string((u64)((time_precise() - group_start) * 1000)), " ms\n");
group_start = time_precise();