Skip to content

Commit

Permalink
Track parser position for error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
joelreymont authored and Hejsil committed Nov 15, 2024
1 parent 5294e51 commit 7100cb3
Show file tree
Hide file tree
Showing 6 changed files with 758 additions and 637 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ const rgb = mecha.combine(.{
test "rgb" {
const testing = std.testing;
const allocator = testing.allocator;
const a = (try rgb.parse(allocator, "#aabbcc")).value;
const a = (try rgb.parse(allocator, "#aabbcc")).ok.value;
try testing.expectEqual(@as(u8, 0xaa), a.r);
try testing.expectEqual(@as(u8, 0xbb), a.g);
try testing.expectEqual(@as(u8, 0xcc), a.b);
const b = (try rgb.parse(allocator, "#abc")).value;
const b = (try rgb.parse(allocator, "#abc")).ok.value;
try testing.expectEqual(@as(u8, 0xaa), b.r);
try testing.expectEqual(@as(u8, 0xbb), b.g);
try testing.expectEqual(@as(u8, 0xcc), b.b);
const c = (try rgb.parse(allocator, "#000000")).value;
const c = (try rgb.parse(allocator, "#000000")).ok.value;
try testing.expectEqual(@as(u8, 0), c.r);
try testing.expectEqual(@as(u8, 0), c.g);
try testing.expectEqual(@as(u8, 0), c.b);
const d = (try rgb.parse(allocator, "#000")).value;
const d = (try rgb.parse(allocator, "#000")).ok.value;
try testing.expectEqual(@as(u8, 0), d.r);
try testing.expectEqual(@as(u8, 0), d.g);
try testing.expectEqual(@as(u8, 0), d.b);
Expand Down
Loading

0 comments on commit 7100cb3

Please sign in to comment.