milestone 17: real deadlines, validator holes, upstream editor, trusted proxies, contract samples, badvers
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
//! contract as openapi.zig's route guard.
|
||||
|
||||
const std = @import("std");
|
||||
const build_options = @import("build_options");
|
||||
const docs = @import("docs_files");
|
||||
const cli = @import("cli.zig");
|
||||
const routes = @import("web/routes.zig");
|
||||
@@ -61,3 +62,33 @@ test "every cli subcommand has its own reference heading in docs/reference/cli.m
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test "no doc page pastes a concrete version into a transcript" {
|
||||
const gpa = std.testing.allocator;
|
||||
// Anchored on the `nxdns ` prefix the transcripts print, not on the bare
|
||||
// version: a release numbered 1.0.0 would otherwise collide with the
|
||||
// 1.0.0.1 upstream address the pages use as an example.
|
||||
const built = try std.fmt.allocPrint(gpa, "nxdns {s}", .{build_options.version_string});
|
||||
defer gpa.free(built);
|
||||
|
||||
for (docs.pages) |page| {
|
||||
// The literal milestone 14 flagged, checked by name as well, so the
|
||||
// guard still bites on a page written against the old default after
|
||||
// `-Dversion-string` moves on.
|
||||
for ([_][]const u8{ built, "0.1.0-dev" }) |needle| {
|
||||
if (std.mem.indexOf(u8, page.text, needle) != null) {
|
||||
std.debug.print("version literal '{s}' in {s}: use the <version> placeholder\n", .{ needle, page.path });
|
||||
return error.VersionLiteralInDocPage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test "every version transcript prints the placeholder" {
|
||||
for (docs.version_transcript_pages) |page| {
|
||||
if (std.mem.indexOf(u8, page.text, "nxdns <version>") == null) {
|
||||
std.debug.print("transcript placeholder 'nxdns <version>' missing from {s}\n", .{page.path});
|
||||
return error.VersionPlaceholderMissingFromDocPage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user