Skip to content

[test] Add lexer cases for comments and strings - #2355

Merged
rossberg merged 4 commits into
WebAssembly:mainfrom
WasmEdge:test-lexer-rules
Nov 26, 2026
Merged

rossberg merged 4 commits into
WebAssembly:mainfrom
WasmEdge:test-lexer-rules

Conversation

@ibmibmibm

Copy link
Copy Markdown
Contributor

Adds cases for a NUL byte in a line comment, invalid UTF-8 in comments, unclosed block comments, and a control character in a string. The NUL cases invoke a function after the comment, so a lexer that skips the rest of the input fails.

comments.wast holds raw NUL bytes, so use git diff --text.

A line comment can hold any character except a line break, so a NUL
byte is valid. Add cases in plain text and inside an annotation. Each
module exports a function after the comment and invokes it, so the
test fails if the lexer skips the rest of the input.
The source text must be valid UTF-8, also inside comments. Add cases
for a line comment, a block comment and a nested block comment.
A block comment must end with ";)". Add cases for an unclosed comment
at the start of the input, after a field, and inside an annotation.
A string literal cannot hold a raw character below U+20. Add a case
with U+01 in a data string.
@ibmibmibm
ibmibmibm marked this pull request as ready for review November 25, 2026 23:25
@rossberg
rossberg merged commit 0493161 into WebAssembly:main Nov 26, 2026
2 checks passed
@ibmibmibm
ibmibmibm deleted the test-lexer-rules branch November 26, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants