forked from ztombol/bats-file
-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
I've started using bats-assert and am now looking into how bats-file can help with file-based assertions. As both libraries are built on bats-support (and have originated from the same author), I see these as closely related projects, and expect consistency in their APIs. However, there seem to be differences that make adoption harder:
- bats-assert uses
assert
andrefute
to distinguish between positive and negative assertions, whereas bats-file usesassert_something
andassert_not_something
. For example,assert_file_not_exists
should be namedrefute_file_exists
to be consistent with bats-assert. - Some negative assertions are missing, e.g. there's no
assert_file_size_not_equals
(or ratherrefute_file_size_equals
), and norefute_files_equal
. assert_file_contains
only does regexp matching; the relatedassert_output
from bats-assert offers complete equivalence, partial (but literal) matching, and regexp matching, making it far more versatile.
All of bats-file's assertions are thin wrappers around test
commands; its main value is in providing a fluent, consistent, and discoverable API. I suggest to align the API with bats-assert, and to add the missing negative assertions and more matching options to assert_file_contains
. This would make the library more powerful and easier to use for users already familiar with bats-assert.
Metadata
Metadata
Assignees
Labels
No labels