cli/itl_expr_cli API
Purpose
cli/itl_expr_cli is the command-line runner for ITF1788 .itl interval
test files. It parses them with frontend/itl_expr,
executes every case against interval and prints a JSON report. It is
normally reached as floating-conformance --backend itl …. See the
tutorial and the
design page.
Importing
The runner is a library, so it can be called from MoonBit code as well as
through the dispatcher. Add it to the import block of your moon.pkg:
import {
"Luna-Flow/floating-tools/cli/itl_expr_cli",
}
The examples use the alias @itl_expr_cli. run reads files through
moonbitlang/x/fs; the repository builds and tests the runners on the native
target.
run
run(arguments) executes one invocation and returns the exit code.
pub fn run(Array[String]) -> Int
arguments[0] is the program name and is ignored. Options:
| Option | Meaning |
|---|---|
--strict-supported | also fail when any case is unsupported |
--operation NAME | keep only cases of this operation; repeatable (cases of any listed operation are kept) |
PATH … | .itl files, read in the given order; default testdata/interval/smoke.itl |
Any other argument starting with - (including --json, --help and the
shard options, which this runner does not have) is an error
unknown option: …; --operation without a value prints
missing value for --operation. Paths are files; directories are not
expanded, and an unreadable path prints cannot read ITL file: PATH. Every
file is parsed completely before the operation filter is applied, so a parse
error in a statement of an unselected operation still ends the run: every
diagnostic of that file is printed as PATH: MESSAGE.
The output is always one JSON object with the keys schemaVersion (1),
runner ("itl-expression-interpreter"), totalCases, executableCases,
passedCases, failedCases, unsupportedCases, diagnosticCases,
failedIds, failedMessages (ID: MESSAGE), unsupportedIds and
diagnosticIds.
Return value: 2 for usage, file or parse errors; 1 when a case failed, a
case was a diagnostic, or with --strict-supported a case was unsupported;
0 otherwise. Cases are executed with the default precision 53.
///|
test "itl runner usage errors" {
inspect(@itl_expr_cli.run(["itl", "--json"]), content="2")
inspect(@itl_expr_cli.run(["itl", "--operation"]), content="2")
inspect(@itl_expr_cli.run(["itl", "--help"]), content="2")
}
Complete public interface
// Generated using `moon info`, DON'T EDIT IT
package "Luna-Flow/floating-tools/cli/itl_expr_cli"
// Values
pub fn run(Array[String]) -> Int32
// Errors
// Types and methods
// Type aliases
// Traits