Skip to content

Commit

Permalink
Merge pull request #207 from serokell/diogo/#206-whitespace-tests
Browse files Browse the repository at this point in the history
[#206] Make bats tests space-sensitive
  • Loading branch information
dcastro authored Oct 26, 2022
2 parents 59cb36c + e93a21e commit 543749a
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 15 deletions.
8 changes: 7 additions & 1 deletion tests/golden/check-cli/check-cli.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand All @@ -45,6 +45,8 @@ load '../helpers'
to_temp xrefcheck --root .

assert_diff - <<EOF
=== Invalid references found ===
➥ In file to-ignore/broken-link.md
Expand All @@ -65,6 +67,8 @@ EOF
to_temp xrefcheck --root ././///././././//./

assert_diff - <<EOF
=== Invalid references found ===
➥ In file to-ignore/broken-link.md
Expand All @@ -85,6 +89,8 @@ EOF
to_temp xrefcheck

assert_diff - <<EOF
=== Invalid references found ===
➥ In file to-ignore/broken-link.md
Expand Down
2 changes: 2 additions & 0 deletions tests/golden/check-footnotes/expected.gold
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


=== Invalid references found ===

➥ In file broken-link-in-footnote/file-with-footnote-with-broken-link.md
Expand Down
14 changes: 8 additions & 6 deletions tests/golden/check-git/check-git.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 2 additions & 3 deletions tests/golden/check-ignore/check-ignore.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions tests/golden/check-ignore/expected.gold
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


=== Scan errors found ===

➥ In file ./to-ignore/inner-directory/broken_annotation.md
Expand Down
2 changes: 2 additions & 0 deletions tests/golden/check-ignoreExternalRefsTo/expected.gold
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


=== Invalid references found ===

➥ In file check-ignoreExternalRefsTo.md
Expand Down
2 changes: 2 additions & 0 deletions tests/golden/check-ignoreLocalRefsTo/expected.gold
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


=== Invalid references found ===

➥ In file check-ignoreLocalRefsTo.md
Expand Down
2 changes: 2 additions & 0 deletions tests/golden/check-ignoreRefsFrom/check-ignoreRefsFrom.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/golden/check-local-refs/expected1.gold
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


=== Invalid references found ===

➥ In file dir1/dir2/d2f1.md
Expand Down
2 changes: 2 additions & 0 deletions tests/golden/check-local-refs/expected2.gold
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


=== Invalid references found ===

➥ In file dir1/dir2/d2f1.md
Expand Down
2 changes: 2 additions & 0 deletions tests/golden/check-local-refs/expected3.gold
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


=== Invalid references found ===

➥ In file dir1/dir2/d2f1.md
Expand Down
1 change: 0 additions & 1 deletion tests/golden/check-scan-errors/expected.gold
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
=== Scan errors found ===


➥ In file check-scan-errors.md
scan error at src:9:1-29:

Expand Down
5 changes: 1 addition & 4 deletions tests/golden/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 543749a

Please sign in to comment.