E81003: argument count mismatch between program and file
What went wrong
The @Test program declares N parameters, but commandline_arg_{id}.txt provides a different number of arguments (one per line).
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 953 (How do @Test programs work with command-line arguments...)
Example error
A '@Test' program 'MyTest()' that declares two parameters (a String 'label' and an Integer 'count'), with a commandline_arg_basic.txt holding the single line "hello", is this error: one argument where two are expected.
How to fix it
- Update commandline file to match program's parameter count
- Or update program's parameter declaration to match args provided
File format
One argument per line. Empty lines are ignored. Order matches parameters.
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E81003: argument count mismatch between program and file - reported by the test runner, not the compiler, when ek9 -t greeting.ek9 runs in this project.
bad/greeting.ek9
#!ek9 defines module error.e81003.bad defines function greeting() as pure -> name as String <- result as String: `Hello, ${name}`
bad/dev/tests.ek9
#!ek9 defines module error.e81003.bad.tests references error.e81003.bad::greeting defines program @Test GreetingCases() -> name as String times as Integer stdout <- Stdout() stdout.println(`${greeting(name)} (${times})`)
bad/dev/commandline_arg_simple.txt
EK9
bad/dev/expected_case_simple.txt
Hello, EK9 (3)
$ ek9 -t greeting.ek9
ℹ️ Found 1 test:
1 assert (unit tests with assertions)
Executing 1 test...
❌ FAIL error.e81003.bad.tests::GreetingCases [Assert] (nms)
Test configuration error: program expects 2 argument(s), but commandline_arg_simple.txt provides 1
Summary: 0 passed, 1 failed (1 total)
Types: 1 assert
Duration: nms
ek9: tests failed (exit 11)
E81003: argument count mismatch between program and file
program expects 2 argument(s), but commandline_arg_simple.txt provides 1
See: ek9 -h E81003
Fixed: commandline_arg_simple.txt holds one line per parameter
good/greeting.ek9
#!ek9 defines module error.e81003.good defines function greeting() as pure -> name as String <- result as String: `Hello, ${name}`
good/dev/tests.ek9
#!ek9 defines module error.e81003.good.tests references error.e81003.good::greeting defines program @Test GreetingCases() -> name as String times as Integer stdout <- Stdout() stdout.println(`${greeting(name)} (${times})`)
good/dev/commandline_arg_simple.txt
EK9 3
good/dev/expected_case_simple.txt
Hello, EK9 (3)
$ ek9 -t greeting.ek9
ℹ️ Found 1 test:
1 parameterized (1 cases total)
Executing 1 test...
✅ PASS error.e81003.good.tests::GreetingCases [Param:simple] (nms)
Summary: 1 passed, 0 failed (1 total)
Types: 1 parameterized
Duration: nms