| 1 | const std = @import("std"); |
| 2 | const ansi = @import("./lib.zig"); |
| 3 | |
| 4 | fn expectFmt(comptime actual: []const u8, expected: []const u8) !void { |
| 5 | return std.testing.expectEqualSlices(u8, expected, actual); |
| 6 | } |
| 7 | |
| 8 | test { |
| 9 | try expectFmt( |
| 10 | ansi.color.Fg(.Blue, "All your codebase"), |
| 11 | &(.{ 27, '[', '3', '4', 'm' } ++ "All your codebase".* ++ .{ 27, '[', '3', '9', 'm' }), |
| 12 | ); |
| 13 | } |
| 14 | test { |
| 15 | try expectFmt( |
| 16 | ansi.color.Bg(.Cyan, "All your codebase"), |
| 17 | &(.{ 27, '[', '4', '6', 'm' } ++ "All your codebase".* ++ .{ 27, '[', '4', '9', 'm' }), |
| 18 | ); |
| 19 | } |