pimterry/notes

BATS fails on "Show multiple files passed by pipe from find"

primis opened this issue · 3 comments

Issue Summary

Commit 00f9e66 which was merge request #71 to fix #38 fails BATS test for show multiple files passed by pipe from find.

The specific failure output is a reversed from expected output as shown in the Technical details section.
This may be a failing of the test itself or a failing of the find code.
However, manually running the test without BATS does not have this failing.

Steps to Reproduce

  1. Run BATS.

Technical details:

  • notes version: master (latest commit: 00f9e66)
    Error from BATS:
not ok 12 Show multiple files passed by pipe from find
(from function `assert_output' in file test/libs/bats-assert/src/assert.bash, line 239,
in test file test/test-cat.bats, line 65)
`assert_output $'line1\nline2'' failed
-- output differs --
expected (2 lines):
  line1
  line2
actual (2 lines):
  line2
  line1
--

To add: my bash version 4.4.12(1)-release is different from the Travis-CI version 4.3.48(1)-release. I am unsure if this has any bearing

Hmm, this is very odd! I can reproduce it locally too, and it's now failing on Travis in the same way. Very odd, especially given that the PR you link above doesn't touch either this logic or the tests, just the completion file. Not sure what's changed to cause this.

When you say:

However, manually running the test without BATS does not have this failing.

what exactly do you mean? For me, running the test suite fails, as does running the one test file directly, or manually running the same commands by hand.

I can't get this test to pass at all now. As far as I can tell it's actually non-deterministic (I think the default sort order of find is not defined), but it's very odd that it's now consistently the 'wrong' order, whilst it was previously consistently the opposite.

In practice, the right solution is probably to either define a fixed order ourselves & sort the results, or make the test allow either order, I think there's arguments for both. I'd love to know why this has happened though, any ideas?