feat: add sts.testing for comparison, test getDescription
parent
c5ada505af
commit
e0007a66e7
|
|
@ -194,13 +194,13 @@ fn getDescription(comptime help: []const u8) []const u8 {
|
||||||
}
|
}
|
||||||
|
|
||||||
test "getDescription" {
|
test "getDescription" {
|
||||||
|
const testing = std.testing;
|
||||||
|
|
||||||
const input = "First sentence with \"quotes\"\nand newlines. Second sentence.";
|
const input = "First sentence with \"quotes\"\nand newlines. Second sentence.";
|
||||||
const expected = "First sentence with \\\"quotes\\\" and newlines.";
|
const expected = "First sentence with \\\"quotes\\\" and newlines.";
|
||||||
const result = comptime getDescription(input);
|
|
||||||
|
|
||||||
comptime {
|
comptime {
|
||||||
if (!std.mem.eql(u8, result, expected)) {
|
const result = getDescription(input);
|
||||||
@compileError("getDescription test failed: expected '" ++ expected ++ "' but got '" ++ result ++ "'");
|
try testing.expectEqualStrings(expected, result);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue