-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem: xrefcheck does not allow to print the config to stdout instead of writing it to a file. Also, it is easy to overwrite your changes by mistake by executing the command again. Solution: provide a --stdout flag to print the config to stdout, and do not write it to a file unless a --force flag has been included.
- Loading branch information
Showing
6 changed files
with
92 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,6 +130,7 @@ executables: | |
dependencies: | ||
- xrefcheck | ||
- universum | ||
- directory | ||
- with-utf8 | ||
- code-page | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env bats | ||
|
||
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io> | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
load '../helpers/bats-support/load' | ||
load '../helpers/bats-assert/load' | ||
load '../helpers/bats-file/load' | ||
load '../helpers' | ||
|
||
|
||
@test "Dump config to stdout" { | ||
to_temp xrefcheck dump-config --stdout -t GitHub | ||
|
||
assert_diff ../../configs/github-config.yaml | ||
} | ||
|
||
@test "Dump config to existent default file error" { | ||
run xrefcheck dump-config -t GitHub | ||
|
||
assert_failure | ||
|
||
assert_output "Output file exists. Use --force to overwrite." | ||
} | ||
|
||
@test "Dump config to existent file error" { | ||
run xrefcheck dump-config -o .config.yaml -t GitHub | ||
|
||
assert_failure | ||
|
||
assert_output "Output file exists. Use --force to overwrite." | ||
} | ||
|
||
@test "Dump config to non existent default file" { | ||
cd $TEST_TEMP_DIR | ||
|
||
run xrefcheck dump-config -t GitHub | ||
|
||
assert_success | ||
} | ||
|
||
@test "Dump config to non existent file" { | ||
cd $TEST_TEMP_DIR | ||
|
||
run xrefcheck dump-config -o .config.yaml -t GitHub | ||
|
||
assert_success | ||
} | ||
|
||
@test "Dump config to existent default file with force" { | ||
cp .xrefcheck.yaml $TEST_TEMP_DIR | ||
cd $TEST_TEMP_DIR | ||
|
||
run xrefcheck dump-config -t GitHub --force | ||
|
||
assert_success | ||
} | ||
|
||
@test "Dump config to existent file with force" { | ||
cp .config.yaml $TEST_TEMP_DIR | ||
cd $TEST_TEMP_DIR | ||
|
||
run xrefcheck dump-config -o .config.yaml -t GitHub --force | ||
|
||
assert_success | ||
} |