From 3b2ab7f68a85fadcb5c1b8c1048c461034dc3e29 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Wed, 1 Jan 2025 20:53:37 -0800 Subject: [PATCH] use expect in tests --- licenses.txt | 1 + test.zig | 15 +-------------- zigmod.yml | 2 ++ 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/licenses.txt b/licenses.txt index 6336b470e0dc9933d1fad883c84eaf86174573d6..728089f444b1699f3c94f6841d719abda91c029f 100644 --- a/licenses.txt +++ b/licenses.txt @@ -1,3 +1,4 @@ MIT: = https://spdx.org/licenses/MIT - This +- git https://github.com/nektro/zig-expect diff --git a/test.zig b/test.zig index f199f1c1da7e29cde0e5b15f9f54cb38f9081018..abb8f9e84aa702fca22424fe3880b1b3aed5f51b 100644 --- a/test.zig +++ b/test.zig @@ -1,19 +1,6 @@ const std = @import("std"); const color = @import("color"); - -fn expect(actual: anytype) Expect(@TypeOf(actual)) { - return .{ .actual = actual }; -} - -fn Expect(T: type) type { - return struct { - actual: T, - - fn toEqual(self: *const @This(), expected: T) !void { - try std.testing.expectEqual(expected, self.actual); - } - }; -} +const expect = @import("expect").expect; test { // https://www.colorhexa.com/4fc3f7 diff --git a/zigmod.yml b/zigmod.yml index 0391a9f9d2e090c0fd77454292bc0189e347cc64..c1cf05c32ed3fecc673e5ec32823ddb5963f5231 100644 --- a/zigmod.yml +++ b/zigmod.yml @@ -4,3 +4,5 @@ main: mod.zig license: MIT description: Color init and transformation library for Zig dependencies: +root_dependencies: + - src: git https://github.com/nektro/zig-expect -- 2.54.0