Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skipping logic #108

Merged
merged 6 commits into from
Feb 22, 2024
Merged

Skipping logic #108

merged 6 commits into from
Feb 22, 2024

Conversation

pgrange
Copy link
Owner

@pgrange pgrange commented Feb 22, 2024

skip_if <condition> <pattern>

If condition is true, will skip all the tests in the current file which match the given pattern.

This can be useful when one has tests that are dependent on system environment, for instance:

skip_if "uname | grep Darwin" linux
skip_if "uname | grep Linux" darwin

test_linux_proc_exists() {
  assert "ls /proc/" "there should exist /proc on Linux"
}
test_darwin_proc_does_not_exist() {
  assert_fail "ls /proc/" "there should not exist /proc on Darwin"
}

will output, on a Linux system:

	Running test_darwin_proc_does_not_exist ... SKIPPED
	Running test_linux_proc_exists ... SUCCESS

One can now decide to not run some tests if they match a given
pattern using the `-s` command line option.
On can now skip some tests in the file if some condition is true.
bash_unit Outdated Show resolved Hide resolved
@pgrange pgrange merged commit 5347d4e into master Feb 22, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant