Zig 0.17.0-dev (Split by item)
This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig library itself.
Zig › compiler/ › resinator/ › lex.zig › testLexNormal
testLexNormal
lex.testLexNormal
fn testLexNormal (source : []const u8 , expected_tokens : []const Token .Id ) !void
File
Code
fn testLexNormal (source : []const u8 , expected_tokens : []const Token .Id ) !void {
var lexer = Lexer .init (source , .{});
if (dumpTokensDuringTests ) std .debug .print ("\n----------------------\n{s}\n----------------------\n" , .{lexer .buffer });
for (expected_tokens ) |expected_token_id | {
const token = try lexer .nextNormal ();
if (dumpTokensDuringTests ) lexer .dump (&token );
try std .testing .expectEqual (expected_token_id , token .id );
}
const last_token = try lexer .nextNormal ();
try std .testing .expectEqual (Token .Id .eof , last_token .id );
}