Erik's ToolBox Documentation
Index

Interpreter Test Reference — Diagnostics and Parsing

These tests verify the lexer and parser: quoted identifiers, case-insensitive date/time literal suffixes, error reporting for bad input, accurate diagnostic line numbers, and duplicate- declaration detection. They ensure that invalid scripts fail with clear, correctly-located messages instead of compiling silently or crashing the compiler.

Test List

Test What it verifies
QuotedIdentifierTests Quoting escapes keywords (real AL semantics): "for", "to", and "downto" become ordinary variable names, and quoted multi-word identifiers ("my var") keep working.
DateTimeLiteralCaseTests Date/time literal suffixes are case-insensitive: 20240101d, 0d, 120000t, 0t, 0dt parse the same as their uppercase forms, in both expression and script contexts.
LexerErrorReportingTests Bad input produces a diagnostic instead of vanishing or crashing: a stray character, a malformed time literal (12T), an invalid date (20241340D), and an unterminated string literal each report a parse diagnostic.
DiagnosticLineNumberTests A diagnostic at a line-final token reports that token's line (trailing trivia must not push it to the next line), and runtime diagnostics report the failing statement's line.
DuplicateIdentifierDiagnosticTests A duplicate declaration produces a clean "Declared twice" diagnostic (not a raw compiler crash) for duplicate procedures, duplicate variables, and a variable colliding with a procedure name; distinct names still compile clean.