Skip to content

make the source hyperlinks work in the fuzzing web interface (currently they construct autodoc URLs) #20982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
andrewrk opened this issue Aug 7, 2024 · 0 comments
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. fuzzing
Milestone

Comments

@andrewrk
Copy link
Member

andrewrk commented Aug 7, 2024

Extracted from #20958.

[nix-shell:~/dev/zig/build-release]$ stage3/bin/zig build test-std  -Dtest-filter="tokenizer" -Dskip-release -Dskip-non-native -Dskip-libc -Dskip-single-threaded --fuzz --debug-rt --port 41099

image

Text from screenshot reproduced below:

fn testTokenize(source: [:0]const u8, expected_token_tags: []const Token.Tag) !void {
    var tokenizer = Tokenizer.init(source);
    for (expected_token_tags) |expected_token_tag| {
        const token = tokenizer.next();
        try std.testing.expectEqual(expected_token_tag, token.tag);
    }
    // Last token should always be eof, even when the last token was invalid,
    // in which case the tokenizer is in an invalid state, which can only be
    // recovered by opinionated means outside the scope of this implementation.
    const last_token = tokenizer.next();
    try std.testing.expectEqual(Token.Tag.eof, last_token.tag);
    try std.testing.expectEqual(source.len, last_token.loc.start);
    try std.testing.expectEqual(source.len, last_token.loc.end);
}

For example in the above snippet, the expectEqual link points to http://127.0.0.1:41099/#.home.andy.dev.zig.lib.std.std.testing.expectEqual.

Instead, it should point to one of these:

  • #std.testing.expectEqual
  • #f123d456 where 123 and 456 are the file and decl indexes respectively.
  • #/home/andy/dev/zig/lib/std/zig/tokenizer.zig:123:456 where 123 and 456 are line and column respectively.

And then the onHashChange logic needs to respond by loading the appropriate file and scrolling the location into view.

@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. fuzzing labels Aug 7, 2024
@andrewrk andrewrk added this to the 0.14.0 milestone Aug 7, 2024
@andrewrk andrewrk modified the milestones: 0.14.0, 0.15.0 Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. fuzzing
Projects
None yet
Development

No branches or pull requests

1 participant