mirror of
https://github.com/serokell/xrefcheck.git
synced 2024-09-11 13:37:36 +03:00
[#206] Make bats tests space-sensitive
Problem: Right now, our bats tests ignore empty lines and leading/trailing whitespace differences between the expected output and the actual output. However, this could lead to accidental bugs in xrefcheck's output. Trailing whitespace isn't very concerning (except when it's excessive and it causes the terminal to line-wrap), but additional/missing empty lines and leading whitespace can lead to significant changes. Solution: Let's make these tests sensitive to empty lines and leading whitespace.
This commit is contained in:
parent
59cb36cb38
commit
e93a21e18a
@ -33,7 +33,7 @@ load '../helpers'
|
||||
assert_output --partial "All repository links are valid."
|
||||
}
|
||||
|
||||
@test "Reduchant slashes in ignore" {
|
||||
@test "Redundant slashes in ignore" {
|
||||
run xrefcheck \
|
||||
--ignore ./././././././//to-ignore/* \
|
||||
--root .
|
||||
@ -45,6 +45,8 @@ load '../helpers'
|
||||
to_temp xrefcheck --root .
|
||||
|
||||
assert_diff - <<EOF
|
||||
|
||||
|
||||
=== Invalid references found ===
|
||||
|
||||
➥ In file to-ignore/broken-link.md
|
||||
@ -65,6 +67,8 @@ EOF
|
||||
to_temp xrefcheck --root ././///././././//./
|
||||
|
||||
assert_diff - <<EOF
|
||||
|
||||
|
||||
=== Invalid references found ===
|
||||
|
||||
➥ In file to-ignore/broken-link.md
|
||||
@ -85,6 +89,8 @@ EOF
|
||||
to_temp xrefcheck
|
||||
|
||||
assert_diff - <<EOF
|
||||
|
||||
|
||||
=== Invalid references found ===
|
||||
|
||||
➥ In file to-ignore/broken-link.md
|
||||
|
@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
=== Invalid references found ===
|
||||
|
||||
➥ In file broken-link-in-footnote/file-with-footnote-with-broken-link.md
|
||||
|
@ -41,16 +41,18 @@ load '../helpers'
|
||||
to_temp xrefcheck
|
||||
|
||||
assert_diff - <<EOF
|
||||
|
||||
|
||||
=== Invalid references found ===
|
||||
|
||||
➥ In file git.md
|
||||
bad reference (relative) at src:1:1-11:
|
||||
- text: "a"
|
||||
- link: ./a.md
|
||||
- anchor: -
|
||||
bad reference (relative) at src:1:1-11:
|
||||
- text: "a"
|
||||
- link: ./a.md
|
||||
- anchor: -
|
||||
|
||||
⛀ File does not exist:
|
||||
a.md
|
||||
⛀ File does not exist:
|
||||
a.md
|
||||
|
||||
|
||||
Invalid references dumped, 1 in total.
|
||||
|
@ -41,10 +41,9 @@ load '../helpers'
|
||||
=== Scan errors found ===
|
||||
|
||||
➥ In file to-ignore/inner-directory/broken_annotation.md
|
||||
scan error at src:9:1-29:
|
||||
|
||||
⛀ Annotation "ignore all" must be at the top of markdown or right after comments at the top
|
||||
scan error at src:9:1-29:
|
||||
|
||||
⛀ Annotation "ignore all" must be at the top of markdown or right after comments at the top
|
||||
|
||||
|
||||
Scan errors dumped, 1 in total.
|
||||
|
@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
=== Scan errors found ===
|
||||
|
||||
➥ In file ./to-ignore/inner-directory/broken_annotation.md
|
||||
|
@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
=== Invalid references found ===
|
||||
|
||||
➥ In file check-ignoreExternalRefsTo.md
|
||||
|
@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
=== Invalid references found ===
|
||||
|
||||
➥ In file check-ignoreLocalRefsTo.md
|
||||
|
@ -32,6 +32,8 @@ load '../helpers'
|
||||
to_temp xrefcheck -c config-directory.yaml
|
||||
|
||||
assert_diff - <<EOF
|
||||
|
||||
|
||||
=== Invalid references found ===
|
||||
|
||||
➥ In file ignoreRefsFrom/inner-directory/bad-reference.md
|
||||
|
@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
=== Invalid references found ===
|
||||
|
||||
➥ In file dir1/dir2/d2f1.md
|
||||
|
@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
=== Invalid references found ===
|
||||
|
||||
➥ In file dir1/dir2/d2f1.md
|
||||
|
@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
=== Invalid references found ===
|
||||
|
||||
➥ In file dir1/dir2/d2f1.md
|
||||
|
@ -1,6 +1,5 @@
|
||||
=== Scan errors found ===
|
||||
|
||||
|
||||
➥ In file check-scan-errors.md
|
||||
scan error at src:9:1-29:
|
||||
|
||||
|
@ -67,9 +67,6 @@ assert_diff() {
|
||||
: "{output_file?}"
|
||||
|
||||
diff $output_file $1 \
|
||||
--ignore-space-change \
|
||||
--ignore-tab-expansion \
|
||||
--ignore-trailing-space \
|
||||
--ignore-blank-lines \
|
||||
--new-file # treat absent files as empty
|
||||
--ignore-trailing-space
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user