make unix2db tests more robust

This commit is contained in:
Motiejus Jakštys 2022-07-21 11:12:04 +03:00
parent 6c311b786f
commit 2ceb3d5c29

View File

@ -148,7 +148,12 @@ test "turbonss-unix2db invalid argument" {
test "turbonss-unix2db trivial error: missing passwd file" { test "turbonss-unix2db trivial error: missing passwd file" {
const allocator = testing.allocator; const allocator = testing.allocator;
const args = &[_][*:0]const u8{}; const args = &[_][*:0]const u8{
"--passwd",
"/does/not/exist/passwd",
"--group",
"/does/not/exist/group",
};
var stderr = ArrayList(u8).init(allocator); var stderr = ArrayList(u8).init(allocator);
defer stderr.deinit(); defer stderr.deinit();
var stdout = ArrayList(u8).init(allocator); var stdout = ArrayList(u8).init(allocator);
@ -156,7 +161,7 @@ test "turbonss-unix2db trivial error: missing passwd file" {
const exit_code = execute(allocator, stdout.writer(), stderr.writer(), args[0..]); const exit_code = execute(allocator, stdout.writer(), stderr.writer(), args[0..]);
try testing.expectEqual(@as(u8, 1), exit_code); try testing.expectEqual(@as(u8, 1), exit_code);
try testing.expectEqualStrings(stderr.items, "ERROR FileNotFound: open 'passwd'\n"); try testing.expectEqualStrings(stderr.items, "ERROR FileNotFound: open '/does/not/exist/passwd'\n");
} }
test "turbonss-unix2db fail" { test "turbonss-unix2db fail" {