Skip to content

Migrating from v1.1.1

Jason Karns edited this page Nov 27, 2018 · 1 revision

Migrating from jasonkarns/bats-assert (ie, v1.1.1)

flunk

Replace with fail (from bats-support).

assert

No change; compatible with: assert. πŸŽ‰

refute

No change; compatible with: refute. πŸŽ‰

assert_success

If invoked without args, no change; compatible with: assert_success. πŸŽ‰

If invoked with optional $output comparison argument, replace assert_success "foo" with: assert_success; assert_output "foo".

(The old assert_success helper, if provided an optional argument, would assert $status == 0 and that $output equaled the optional argument. The new helper only asserts on the status code. Asserting on output must be done separately with assert_output.)

assert_failure

If invoked without args, no change; compatible with: assert_failure. πŸŽ‰

If invoked with optional $output comparison argument, replace assert_failure "foo" with: assert_failure; assert_output "foo".

(The old assert_failure helper, if provided an optional argument, would assert $status != 0 and that $output equaled the optional argument. The new helper only asserts on the status code. Asserting on output must be done separately with assert_output.)

assert_equal

No change; compatible with: assert_equal. πŸŽ‰

assert_contains

If used to assert against $output, replace assert_contains "$output" foo with assert_output --partial foo.

If used to assert against an arbitrary value, there is no replacement. 😞

refute_contains

If used to assert against $output, replace refute_contains "$output" foo with refute_output --partial foo.

If used to assert against an arbitrary value, there is no replacement. 😞

assert_starts_with

If used to assert against $output, replace assert_starts_with "$output" "foo" with `assert_output --regexp '^foo'.

If used to assert against an arbitrary value, there is no replacement. 😞

assert_output

No change; compatible with: assert_output. πŸŽ‰

assert_output_contains

Replace with assert_output --partial foo.

refute_output_contains

Replace with refute_output --partial foo.

assert_line

If merely checking for line existence (no line number argument), no change; compatible with: assert_line. πŸŽ‰

If asserting against a particular line number with the optional line number argument, replace: assert_line N foo with assert_line --index N foo.

refute_line

If merely checking for line existence (no line number argument), no change; compatible with: refute_line. πŸŽ‰

If asserting against a particular line number with the optional line number argument, replace: refute_line N foo with refute_line --index N foo.