Skip to content

Commit

Permalink
fix: test for Atom.dependOn
Browse files Browse the repository at this point in the history
  • Loading branch information
zenith391 committed May 5, 2024
1 parent 3645fdb commit f609c44
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/data.zig
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,9 @@ pub fn Atom(comptime T: type) type {

test dependOn {
var a = Atom(u64).of(1);
defer a.deinit();
var b = Atom([]const u8).of("Hello");
defer b.deinit();

const cFunction = struct {
fn cFunction(int: u64, string: []const u8) u64 {
Expand All @@ -567,6 +569,7 @@ pub fn Atom(comptime T: type) type {

// Alternatively, you could use Atom.derived instead of .of(undefined)
var c = Atom(u64).of(undefined);
defer c.deinit();
try c.dependOn(.{ &a, &b }, &cFunction);
// now c is equal to 6 because 1 + 5 = 6

Expand Down

0 comments on commit f609c44

Please sign in to comment.