fetch_ml/cli/tests/rsync_embedded_test.zig

30 lines
908 B
Zig

const std = @import("std");
const testing = std.testing;
// Simple mock rsync for testing
const MockRsyncEmbedded = struct {
const EmbeddedRsync = struct {
allocator: std.mem.Allocator,
fn extractRsyncBinary(self: EmbeddedRsync) ![]const u8 {
// Simple mock - return a dummy path
return try std.fmt.allocPrint(self.allocator, "/tmp/mock_rsync", .{});
}
};
};
const rsync_embedded = MockRsyncEmbedded;
test "embedded rsync binary creation" {
const allocator = testing.allocator;
var embedded_rsync = rsync_embedded.EmbeddedRsync{ .allocator = allocator };
// Test binary extraction
const rsync_path = try embedded_rsync.extractRsyncBinary();
defer allocator.free(rsync_path);
// Verify the path was created
try testing.expect(rsync_path.len > 0);
try testing.expect(std.mem.startsWith(u8, rsync_path, "/tmp/"));
}