Skip to content

Commit

Permalink
explicit load
Browse files Browse the repository at this point in the history
  • Loading branch information
schmee committed Jan 25, 2024
1 parent 7a617e2 commit 4fc7a55
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ const TmpDb = struct {
}

fn linkDb(self: *Self) LinkDb {
self.loadFiles();
return main.LinkDb{ .allocator = allocator, .file = self.files.?.links };
}

fn chainDb(self: *Self) ChainDb {
self.loadFiles();
return main.ChainDb{ .allocator = allocator, .file = self.files.?.chains, .show = .all };
}

Expand Down Expand Up @@ -77,6 +75,9 @@ test "basic" {
try runCommand(db.path, arg);
}

db.loadFiles();
defer db.unloadFiles();

var chain_db = db.chainDb();
try chain_db.materialize();
const meta = chain_db.meta;
Expand Down Expand Up @@ -124,6 +125,7 @@ test "linking same day twice" {
}

{
db.loadFiles();
defer db.unloadFiles();

var link_db = db.linkDb();
Expand All @@ -137,6 +139,9 @@ test "linking same day twice" {

try runCommand(db.path, "link 1 20240101");
{
db.loadFiles();
defer db.unloadFiles();

var link_db = db.linkDb();
try link_db.materialize(1);

Expand Down

0 comments on commit 4fc7a55

Please sign in to comment.