Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit 90f9b14

Browse files
author
Jeremy Wiebe
committed
Add test for bad filename rule
1 parent 93abdfd commit 90f9b14

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
a-bad-filename.md
3+
1:1 warning Do not start file names with `a` no-file-name-articles remark-lint
4+
5+
⚠ 1 warning

docs/test/a-bad-filename.md

Whitespace-only changes.

docs/test/test.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,25 @@ LINT_MD="$TEST_DIR/../bin/lint-md"
1212
# Re-generate `.expected` files with current configuration.
1313
#"$LINT_MD" "$TEST_DIR/good.md" --no-color > "$TEST_DIR/good.expected.md" 2>&1
1414
#"$LINT_MD" "$TEST_DIR/bad.md" --no-color > "$TEST_DIR/bad.expected.md" 2>&1
15+
#"$LINT_MD" "$TEST_DIR/a-bad-filename.md" --no-color > "$TEST_DIR/a-bad-filename.expected.md" 2>&1
1516

1617
# Compare remark output with expected output. Fail on diff.
18+
echo "Testing good.md ..."
1719
diff <("$LINT_MD" "$TEST_DIR/good.md" --no-color 2>&1) "$TEST_DIR/good.expected.md"
1820
EXIT_GOOD=$?
21+
22+
echo "Testing bad.md ..."
1923
diff <("$LINT_MD" "$TEST_DIR/bad.md" --no-color 2>&1) "$TEST_DIR/bad.expected.md"
2024
EXIT_BAD=$?
2125

22-
# Fail if either diff failed
23-
exit $EXIT_GOOD || $EXIT_BAD
26+
echo "Testing a-bad-filename.expected.md ..."
27+
diff <("$LINT_MD" "$TEST_DIR/a-bad-filename.md" --no-color 2>&1) "$TEST_DIR/a-bad-filename.expected.md"
28+
EXIT_BAD_FILENAME=$?
29+
30+
# Fail if either diff failed.
31+
# This if will fall apart quickly as we add more test cases.
32+
# Need to consider some type of looping, etc possibly.
33+
if [ "$EXIT_GOOD" -ne "0" ] || [ "$EXIT_BAD" -ne "0" ] || [ "$EXIT_BAD_FILENAME" -ne "0" ]; then
34+
echo "One or more tests failed!"
35+
exit 1
36+
fi

0 commit comments

Comments
 (0)