const std = @import("std"); const ssh = @import("ssh.zig"); pub fn main() anyerror!void { var client = ssh.Client.init("localhost") catch unreachable; const stdout = std.io.getStdOut(); client.run("pwd", stdout) catch unreachable; client.run("who", stdout) catch unreachable; client.deinit(); } test "basic test" { // this test requires you can ssh localhost without a password prompt // (typically by having your ssh_agent running) var client = ssh.Client.init("localhost") catch unreachable; var buffer = std.ArrayList(u8).init(std.testing.allocator); defer buffer.deinit(); client.run("echo test", buffer.writer()) catch unreachable; try std.testing.expectEqualSlices(u8, buffer.items, "test\n"); client.deinit(); }