Redirect stderr test (#UN3) fails when cat-ing existing error log file - potential test setup issue

I noticed an issue with the shell project’s stderr redirection test (#UN3). The test assumes a file doesn’t exist when it was just created by previous test steps.

Relevant test logs:

[your-program] $ echo "James says Error" 2>> /tmp/baz/qux.md
[your-program] James says Error
[tester::#UN3] ✓ Received redirected file content

[your-program] $ cat nonexistent 2>> /tmp/baz/qux.md
[your-program] $ ls -1 nonexistent 2>> /tmp/baz/qux.md
[your-program] $ cat /tmp/baz/qux.md
[your-program] cat /tmp/baz/qux.md

[tester::#UN3] Output does not match expected value.
[tester::#UN3] Expected: "cat: nonexistent: No such file or directory"
[tester::#UN3] Received: "cat /tmp/baz/qux.md"

The test attempts to verify error redirection after the file already exists from previous steps. This makes the test unreliable.

Suggested fixes:

  • Clean up test files between assertions
  • Use unique file paths for each test case
  • Verify file existence before assertions

What do you think? Happy to provide more details or help implement a fix.

Hi, thanks for your post!

I’m currently out of the office and will return on Feb 3. I’ll get back to you as soon as possible after I’m back.