E81004: arguments provided for no-parameter program
What went wrong
Commandline argument files found for a @Test program that declares no parameters. The program cannot receive arguments.
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 'SimpleTest()' that declares no parameters, in a directory that also holds commandline_arg_test1.txt, is this error: the arguments in that file have nowhere to go.
How to fix it
- Add parameters to @Test program if it should accept args
- Or remove commandline/expected files if args aren't needed
- Or use simple expected_output.txt for tests without parameters
Common causes
- Forgot to add parameters to @Test program
- Created argument files for wrong test
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E81004: arguments provided for no-parameter program - reported by the test runner, not the compiler, when ek9 -t greeting.ek9 runs in this project.
bad/greeting.ek9
#!ek9 defines module error.e81004.bad defines function greeting() as pure -> name as String <- result as String: `Hello, ${name}`
bad/dev/tests.ek9
#!ek9 defines module error.e81004.bad.tests references error.e81004.bad::greeting defines program @Test GreetingOnce() stdout <- Stdout() stdout.println(greeting("EK9"))
bad/dev/commandline_arg_simple.txt
EK9
bad/dev/expected_case_simple.txt
Hello, EK9
$ ek9 -t greeting.ek9
ℹ️ Found 1 test:
1 assert (unit tests with assertions)
Executing 1 test...
❌ FAIL error.e81004.bad.tests::GreetingOnce [Assert] (nms)
Test configuration error: program declares no parameters but 1 commandline_arg file(s) found
Summary: 0 passed, 1 failed (1 total)
Types: 1 assert
Duration: nms
ek9: tests failed (exit 11)
E81004: arguments provided for no-parameter program
program declares no parameters but 1 commandline_arg file(s) found
See: ek9 -h E81004
Fixed: A program that takes no arguments is checked by expected_output.txt
good/greeting.ek9
#!ek9 defines module error.e81004.good defines function greeting() as pure -> name as String <- result as String: `Hello, ${name}`
good/dev/tests.ek9
#!ek9 defines module error.e81004.good.tests references error.e81004.good::greeting defines program @Test GreetingOnce() stdout <- Stdout() stdout.println(greeting("EK9"))
good/dev/expected_output.txt
Hello, EK9
$ ek9 -t greeting.ek9
ℹ️ Found 1 test:
1 blackbox (output validated against expected_output.txt)
Executing 1 test...
✅ PASS error.e81004.good.tests::GreetingOnce [BlackBox] (nms)
Summary: 1 passed, 0 failed (1 total)
Types: 1 blackbox
Duration: nms