~gpanders/wk

95094c3acc1ddfcbda2a0ba1905aac4632b9b8a8 — Greg Anders 2 months ago 8d2bfa7
Fix findZettel unit test
1 files changed, 14 insertions(+), 14 deletions(-)

M src/zettel.zig
M src/zettel.zig => src/zettel.zig +14 -14
@@ 294,20 294,20 @@ test "findZettel" {
        },
    };

    expectEqual(zettels[0], findZettel(zettels, "12345678900000").?);
    expectEqual(zettels[0], findZettel(zettels, "12345678900000-test-one" ++ extension).?);
    expectEqual(zettels[0], findZettel(zettels, "12345678900000-test-one").?);
    expectEqual(zettels[0], findZettel(zettels, "Test One").?);

    expectEqual(zettels[1], findZettel(zettels, "12345678900001").?);
    expectEqual(zettels[1], findZettel(zettels, "12345678900001-test-two" ++ extension).?);
    expectEqual(zettels[1], findZettel(zettels, "12345678900001-test-two").?);
    expectEqual(zettels[1], findZettel(zettels, "Test Two").?);

    expectEqual(@as(?Zettel, null), findZettel(zettels, "12345678900002"));
    expectEqual(@as(?Zettel, null), findZettel(zettels, "12345678900002-test-three" ++ extension));
    expectEqual(@as(?Zettel, null), findZettel(zettels, "12345678900002-test-three"));
    expectEqual(@as(?Zettel, null), findZettel(zettels, "Test Three"));
    expectEqual(&zettels[0], findZettel(zettels, "12345678900000").?);
    expectEqual(&zettels[0], findZettel(zettels, "12345678900000-test-one" ++ extension).?);
    expectEqual(&zettels[0], findZettel(zettels, "12345678900000-test-one").?);
    expectEqual(&zettels[0], findZettel(zettels, "Test One").?);

    expectEqual(&zettels[1], findZettel(zettels, "12345678900001").?);
    expectEqual(&zettels[1], findZettel(zettels, "12345678900001-test-two" ++ extension).?);
    expectEqual(&zettels[1], findZettel(zettels, "12345678900001-test-two").?);
    expectEqual(&zettels[1], findZettel(zettels, "Test Two").?);

    expectEqual(@as(?*const Zettel, null), findZettel(zettels, "12345678900002"));
    expectEqual(@as(?*const Zettel, null), findZettel(zettels, "12345678900002-test-three" ++ extension));
    expectEqual(@as(?*const Zettel, null), findZettel(zettels, "12345678900002-test-three"));
    expectEqual(@as(?*const Zettel, null), findZettel(zettels, "Test Three"));
}

fn fromEntry(allocator: *mem.Allocator, entry: fs.Dir.Entry) !Zettel {