Erik's ToolBox Documentation
Index

Interpreter Test Reference — Built-in Functions

These tests verify the global built-in functions and text instance methods: string handling, format/evaluate (including the failure path), date/time builtins, Text.Split, GUID and list helpers, environment builtins, and how containers and options render through format and %1 placeholders.

Test List

Test What it verifies
CompilerTests A smoke suite of complete scripts: record iteration, arithmetic, procedures with var parameters and nested calls, record-by-reference through two procedures, clear for every type, master/detail record loops, an option member named codeunit, createdatetime, and maxstrlen.
StringBuiltInScriptTests The string builtins in scripts: maxstrlen, strlen, copystr (2- and 3-arg), delstr, uppercase/lowercase, padstr, selectstr, strpos, insstr, incstr, convertstr, strsubstno, and strchecksum.
CopyStrOverloadTests The two-argument copystr(text, position) means "from position to the end" (not length 0); the three-argument form extracts a fixed length. (Audit spec.)
TextMethodTests Text instance methods via dot notation: Contains, StartsWith, EndsWith, IndexOf, LastIndexOf, Trim/TrimStart/TrimEnd, ToUpper/ToLower, Substring, Remove, Replace, PadLeft, PadRight.
FormatAndEvaluateTests format of variables and literals, evaluate round-trips for Integer/Decimal/Boolean/Text, evaluate as a Boolean expression (fail and succeed), and format(date, 0, 9) (XML format).
EvaluateFailurePreservesTargetTests A failed evaluate returns false and leaves the target unchanged — the key regression being Guid (its buffer was Text, so bad input used to "succeed"); the statement form raises a diagnostic; valid input still round-trips. Native-spec mirrored.
DateTimeBuiltinTests dt2date/dt2time decomposition, dwy2date (expectation computed natively), the workdate setter, closingdate/normaldate round-trip and marker, and seeded randomize determinism.
TextSplitAndTrimTests Text.Split returns a 1-based List of [Text] (single and multiple separators), iterable with foreach; parameterless TrimStart/TrimEnd trim whitespace.
GuidAndListBuiltinTests isnullguid on unassigned vs real GUIDs, and List.AddRange appending one list to another.
EnvironmentBuiltinTests userid, guiallowed, and sessionid work in both call form and bare-name form, and the two forms agree.
FormatContainerTests format(json) and %1 placeholders render JSON objects, arrays, and values exactly like native Format; Lists and Dictionaries format via their JSON backing; strsubstno shares the same evaluator. Native-mirrored on captured console output.
FormatWithLengthTests format(value, length) pads to exactly length for Code (the Code/Option arms of the multi-argument dispatch), matching native output; plain format(code) still uppercases. Native-spec mirrored.
OptionSubstitutionTests %1 substitution renders an Option as its member name (matching format), not the raw ordinal. (Audit spec.)