cli: add xdg-terminal-exec parsing tests

Add two tests for parsing of xdg-terminal-exec.
This commit is contained in:
Tim Culverhouse
2023-12-19 08:41:29 -06:00
parent e92f8b28d5
commit 1137da9238

View File

@ -1847,6 +1847,28 @@ test "parse e: command and args" {
try testing.expectEqualStrings("echo foo bar baz", cfg.command.?); try testing.expectEqualStrings("echo foo bar baz", cfg.command.?);
} }
test "parse xdg-terminal-exec: command and args" {
const testing = std.testing;
var cfg = try Config.default(testing.allocator);
defer cfg.deinit();
const alloc = cfg._arena.?.allocator();
var it: TestIterator = .{ .data = &.{ "echo", "foo", "bar baz" } };
try testing.expect(!try cfg.parseManuallyHook(alloc, "xdg-terminal-exec", &it));
try testing.expectEqualStrings("echo foo bar baz", cfg.command.?);
}
test "parse xdg-terminal-exec: command and args with abs path" {
const testing = std.testing;
var cfg = try Config.default(testing.allocator);
defer cfg.deinit();
const alloc = cfg._arena.?.allocator();
var it: TestIterator = .{ .data = &.{ "echo", "foo", "bar baz" } };
try testing.expect(!try cfg.parseManuallyHook(alloc, "/home/ghostty/.local/bin/xdg-terminal-exec", &it));
try testing.expectEqualStrings("echo foo bar baz", cfg.command.?);
}
test "clone default" { test "clone default" {
const testing = std.testing; const testing = std.testing;
const alloc = testing.allocator; const alloc = testing.allocator;