feat: add test for getDescription

pull/9551/head
Denys Zhak 2025-11-17 01:22:33 +01:00
parent 2ee1f3191e
commit c5ada505af
1 changed files with 12 additions and 0 deletions

View File

@ -192,3 +192,15 @@ fn getDescription(comptime help: []const u8) []const u8 {
return out[0..len]; return out[0..len];
} }
test "getDescription" {
const input = "First sentence with \"quotes\"\nand newlines. Second sentence.";
const expected = "First sentence with \\\"quotes\\\" and newlines.";
const result = comptime getDescription(input);
comptime {
if (!std.mem.eql(u8, result, expected)) {
@compileError("getDescription test failed: expected '" ++ expected ++ "' but got '" ++ result ++ "'");
}
}
}