You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 and refute to distinguish between positive and negative assertions, whereas bats-file uses assert_something and assert_not_something. For example, assert_file_not_exists should be named refute_file_exists to be consistent with bats-assert.
Some negative assertions are missing, e.g. there's no assert_file_size_not_equals (or rather refute_file_size_equals), and no refute_files_equal.
assert_file_contains only does regexp matching; the related assert_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.
The text was updated successfully, but these errors were encountered:
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:
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.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 toassert_file_contains
. This would make the library more powerful and easier to use for users already familiar with bats-assert.The text was updated successfully, but these errors were encountered: