Three of the four refusals of is_sql_literal assert nothing, including the quote and the backslash #18
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Keel-Linux/keel-mariadb#18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A bats test body has no assertions of its own: its verdict is the exit status of the last command it ran. Bash does not apply errexit to a negated command, so
! cmdon its own line decides the test when it is the final command of the body and is inert everywhere else.tests/boot-test.bats, lines 516–518:Three of the four refusals did not run, and they include the two that matter: a value carrying a single quote and a value carrying a backslash.
bt_is_sql_literalis what stops the boot test putting a value it did not generate inside single quotes in a statement — its own comment says so — and its quote and backslash cases were not being checked.The same file already uses
run !at line 510, so the form and thebats_require_minimum_version 1.5.0declaration are already here; these four lines were simply written the other way.tests/hook.batsline 163 is in final position and does assert.What to do
Write every negation
run ! cmd, the ones in final position included, so that no line's meaning depends on its position.Test plan
shellcheck --severity=error --include=SC2314overtests/*.batsreports nothing.bats tests/*.batsgreen with the three inert assertions live.tests/coverage.shat or above the committed threshold of 95.package / changelogpasses by reporting that nothing that ships changed.