Erik's ToolBox Documentation
Index

Interpreter Test Reference — Codeunits and Streams

These tests verify calling standard codeunits from scripts (argument passing, reference semantics, scope, and error surfacing) and the stream/blob feature set that several codeunits build on.

Codeunit Calls

Test What it verifies
CodeunitCallScriptTests Calling codeunit members with literal, variable, and expression arguments; a call result used inside an expression; quoted subtypes and integer parameters (Type Helper.BitwiseAnd); var-parameter write-back through the argument frame (GetHmsFromTime); and error surfacing for a bad overload and an unknown function.
CodeunitReferenceSemanticsTests Codeunits are reference types: state persists across calls on the same variable, and assignment shares the instance rather than minting a fresh one (verified via Rest Client base address). (Audit spec.)
CodeunitScopeTests Codeunit variables work as procedure locals and as parameters, not only as globals (Math used in both roles). (Audit spec.)
PostingCodeunitTests Purch.-Post surfaces posting errors as diagnostics in statement form, and the expression form traps the error and returns false; also exercises calling run as a member even though it lexes as a keyword. (Audit spec.)
NewStandardCodeunitTests Declaration smoke for No. Series, Release Sales/Purchase Document, Gen. Jnl.-Post Batch, Email, and Email Message; the release surface validates its record argument; Email.Send validates argument shape and rejects an uncreated message; and Format Address exercises both shapes — the native array[8] of Text form (fills the array) and the text/record form (returns a List of [Text]), including array-dimension validation.

Standard Codeunit Behavior

Test What it verifies
Base64ConvertTests Base64 Convert: text round-trip (Hello↔SGVsbG8=), the InStream source overload, and the decode-to-OutStream overload.
RegexCodeunitTests Regex: IsMatch, Replace, and Split (returning a List of [Text]); an unknown member surfaces the implementation error.
DataCompressionTests Data Compression: a full zip round-trip (create → add → save → reopen → list → extract) and a gzip round-trip with the IsGzip probe.
EnvironmentInfoCodeunitTests Environment Information: the script answers for IsSandbox/IsProduction/IsSaaS/IsOnPrem/GetEnvironmentName agree with the native codeunit for the current environment (spec-first).

Streams

Test What it verifies
StreamAndTempBlobTests Temp Blob and streams: an OutStream/InStream write-read round-trip with HasValue/Length, the ReadText() convenience form and Eos, the JSON WriteTo/ReadFrom stream overloads, copystream between two blobs, and streams passed as procedure parameters sharing the reference.