diff --git a/src/termio.zig b/src/termio.zig index aec3aab23..45382cda1 100644 --- a/src/termio.zig +++ b/src/termio.zig @@ -16,4 +16,6 @@ pub const Impl = Exec; test { @import("std").testing.refAllDecls(@This()); + + _ = @import("termio/shell_integration.zig"); } diff --git a/src/termio/shell_integration.zig b/src/termio/shell_integration.zig index 95d86eaae..8693e7fce 100644 --- a/src/termio/shell_integration.zig +++ b/src/termio/shell_integration.zig @@ -29,8 +29,8 @@ pub fn setup( features: config.ShellIntegrationFeatures, ) !?Shell { const exe = if (force_shell) |shell| switch (shell) { - .fish => "/fish", - .zsh => "/zsh", + .fish => "fish", + .zsh => "zsh", } else std.fs.path.basename(command_path); const shell: Shell = shell: { @@ -123,3 +123,16 @@ fn setupZsh( ); try env.put("ZDOTDIR", integ_dir); } + +test "force shell" { + const testing = std.testing; + const alloc = testing.allocator; + + var env = EnvMap.init(alloc); + defer env.deinit(); + + inline for (@typeInfo(Shell).Enum.fields) |field| { + const shell = @field(Shell, field.name); + try testing.expectEqual(shell, setup(alloc, ".", "sh", &env, shell, .{})); + } +}