mirror of
https://github.com/serokell/xrefcheck.git
synced 2024-08-17 09:30:35 +03:00
Problem: We're using a common pattern in our bats tests: Run xrefcheck, redirect output to a temp file Check the temp file matches some .gold file using `diff` Delete temp file We could encapsulate this pattern and make it easier to reuse. Solution: In the `setup` function, create a temp directory. In the `teardown` function, delete the temp directory. Create a `to_temp` function that runs xrefcheck with desired options, pipes its output through the `prepare` helper function and saves it in a file inside the temp directory. Create a `assert_diff` function that reads the temp file, and uses `diff` to compare it against some expected output.
14 lines
509 B
Plaintext
14 lines
509 B
Plaintext
# SPDX-FileCopyrightText: 2021 Serokell <https://serokell.io>
|
|
#
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
[submodule "tests/golden/helpers/bats-assert"]
|
|
path = tests/golden/helpers/bats-assert
|
|
url = git@github.com:bats-core/bats-assert.git
|
|
[submodule "tests/golden/helpers/bats-support"]
|
|
path = tests/golden/helpers/bats-support
|
|
url = git@github.com:bats-core/bats-support.git
|
|
[submodule "tests/golden/helpers/bats-file"]
|
|
path = tests/golden/helpers/bats-file
|
|
url = https://github.com/bats-core/bats-file.git
|