E81001: missing expected output file for test case

Category: E81xxx-E83xxx Test configuration, execution and coverage · Classification: MISSING_EXPECTED_OUTPUT · All error codes

What went wrong

A commandline_arg_{id}.txt file exists but no matching expected_case_{id}.txt. Parameterized tests require both files with matching {id}.

Worked examples

Compilable examples demonstrating this error and the correct fix:

  • ek9 -q 953 (How do @Test programs work with command-line arguments...)

File naming pattern

Each commandline_arg_{id}.txt pairs with the expected_case_{id}.txt of the same {id}. For instance, a dev/ directory holding commandline_arg_hello.txt but no expected_case_hello.txt is this error.

How to fix it

  1. Capture expected output: `ek9 -r tests.ek9 $(cat commandline_arg_{id}.txt) > expected_case_{id}.txt`
  2. Or create manually: `touch dev/expected_case_{id}.txt`
  3. Or rename if typo (check -E2 for fuzzy suggestions)
  4. Or remove orphan commandline file if test isn't needed

See also

  • E81001: commandline file exists, expected file missing (this error)
  • E81002: expected file exists, commandline file missing

Examples

Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.

Fails with E81001: missing expected output file for test case - reported by the test runner, not the compiler, when ek9 -t greeting.ek9 runs in this project.

bad/greeting.ek9

#!ek9
defines module error.e81001.bad

  defines function

    greeting() as pure
      -> name as String
      <- result as String: `Hello, ${name}`

bad/dev/tests.ek9

#!ek9
defines module error.e81001.bad.tests

  references
    error.e81001.bad::greeting

  defines program

    @Test
    GreetingCases()
      -> name as String
      stdout <- Stdout()
      greeted <- greeting(name)
      stdout.println(greeted)
      assert greeted == `Hello, ${name}`

bad/dev/commandline_arg_simple.txt

EK9
$ ek9 -t greeting.ek9
ℹ️ Found 1 test:
  1 assert (unit tests with assertions)

Executing 1 test...

❌ FAIL error.e81001.bad.tests::GreetingCases [Assert] (nms)
    Test configuration error: missing expected_case_simple.txt

Summary: 0 passed, 1 failed (1 total)
Types: 1 assert
Duration: nms
ek9: tests failed (exit 11)
E81001: missing expected output file for test case
  missing expected_case_simple.txt
  See: ek9 -h E81001

Fixed: Each commandline_arg_simple.txt has its expected_case_simple.txt

good/greeting.ek9

#!ek9
defines module error.e81001.good

  defines function

    greeting() as pure
      -> name as String
      <- result as String: `Hello, ${name}`

good/dev/tests.ek9

#!ek9
defines module error.e81001.good.tests

  references
    error.e81001.good::greeting

  defines program

    @Test
    GreetingCases()
      -> name as String
      stdout <- Stdout()
      greeted <- greeting(name)
      stdout.println(greeted)
      assert greeted == `Hello, ${name}`

good/dev/commandline_arg_simple.txt

EK9

good/dev/expected_case_simple.txt

Hello, EK9
$ ek9 -t greeting.ek9
ℹ️ Found 1 test:
  1 parameterized_hybrid (parameterized with assertions)

Executing 1 test...

✅ PASS error.e81001.good.tests::GreetingCases [Param:simple] (nms)

Summary: 1 passed, 0 failed (1 total)
Types: 1 parameterized_hybrid
Duration: nms

Found a problem?

If EK9 reported E81001 for a program you think is valid, or did not report it where it should have, use the compiler form with the smallest program that shows it. If this page is wrong or unclear, use the documentation form. Both are at github.com/ek9lang/ek9-issues.