diff options
author | EuAndreh <eu@euandre.org> | 2022-01-21 00:40:28 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2022-02-19 16:33:23 -0300 |
commit | e6ac7e8bf6b27e6f752b1b8cee08057d9e57c0b3 (patch) | |
tree | 7d1de5973ebc202e69ae077d481c130bf1934c1e | |
parent | aux/workflow/assert-todos.sh: Remove ad-hoc TODOs.md linting rules (diff) | |
download | td-e6ac7e8bf6b27e6f752b1b8cee08057d9e57c0b3.tar.gz td-e6ac7e8bf6b27e6f752b1b8cee08057d9e57c0b3.tar.xz |
tests/linting.sh: Add initial setup for testing lint checks
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | tests/lint-resources/bad-status-dates/TODOs.md | 6 | ||||
-rw-r--r-- | tests/lint-resources/duplicate-id/TODOs.md | 7 | ||||
-rw-r--r-- | tests/lint-resources/empty-file/TODOs.md | 0 | ||||
-rw-r--r-- | tests/lint-resources/full-file/TODOs.md | 0 | ||||
-rw-r--r-- | tests/lint-resources/inconsistent-status/TODOs.md | 6 | ||||
-rw-r--r-- | tests/lint-resources/invalid-state/TODOs.md | 5 | ||||
-rw-r--r-- | tests/lint-resources/missing-id/TODOs.md | 4 | ||||
-rw-r--r-- | tests/lint-resources/out-of-order-sections/TODOs.md | 16 | ||||
-rw-r--r-- | tests/lint-resources/scattered-known-sections/TODOs.md | 0 | ||||
-rw-r--r-- | tests/lint-resources/with-no-known-sections/TODOs.md | 9 | ||||
-rw-r--r-- | tests/lint-resources/with-some-known-sections/TODOs.md | 14 | ||||
-rwxr-xr-x | tests/linting.sh | 22 |
13 files changed, 90 insertions, 0 deletions
@@ -78,6 +78,7 @@ check: all sh tests/cli-opts.sh sh tests/config.sh sh tests/workflow.sh + sh tests/linting.sh clean: rm -rf \ diff --git a/tests/lint-resources/bad-status-dates/TODOs.md b/tests/lint-resources/bad-status-dates/TODOs.md new file mode 100644 index 0000000..47c16a7 --- /dev/null +++ b/tests/lint-resources/bad-status-dates/TODOs.md @@ -0,0 +1,6 @@ +# Tasks + +## DONE A task {#td-ad324b7c-9aee-4923-927c-539b90c003cc} +- DONE in 2000-01-02 +- DOING in 2000-01-03 +- TODO in 2000-01-01 diff --git a/tests/lint-resources/duplicate-id/TODOs.md b/tests/lint-resources/duplicate-id/TODOs.md new file mode 100644 index 0000000..bc80ba9 --- /dev/null +++ b/tests/lint-resources/duplicate-id/TODOs.md @@ -0,0 +1,7 @@ +# Tasks + +## TODO A task {#td-21c4cbb9-b0b8-425b-acb2-7dd12c14d4a6} +- TODO in 1970-01-01 + +## TODO A different task but with the same ID {#td-21c4cbb9-b0b8-425b-acb2-7dd12c14d4a6} +- TODO in 1970-01-01 diff --git a/tests/lint-resources/empty-file/TODOs.md b/tests/lint-resources/empty-file/TODOs.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/lint-resources/empty-file/TODOs.md diff --git a/tests/lint-resources/full-file/TODOs.md b/tests/lint-resources/full-file/TODOs.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/lint-resources/full-file/TODOs.md diff --git a/tests/lint-resources/inconsistent-status/TODOs.md b/tests/lint-resources/inconsistent-status/TODOs.md new file mode 100644 index 0000000..145acda --- /dev/null +++ b/tests/lint-resources/inconsistent-status/TODOs.md @@ -0,0 +1,6 @@ +# Tasks + +## DOING A task {#td-73dc4f51-0136-4ed3-9155-4dff2815b582} +- DONE in 1970-01-01 +- DOING in 1970-01-01 +- TODO in 1970-01-01 diff --git a/tests/lint-resources/invalid-state/TODOs.md b/tests/lint-resources/invalid-state/TODOs.md new file mode 100644 index 0000000..843f4fc --- /dev/null +++ b/tests/lint-resources/invalid-state/TODOs.md @@ -0,0 +1,5 @@ +# Tasks + +## WIP A task {#td-8d4da599-fb9f-4b08-9e1c-43a9e86e640b} +- WIP in 1970-01-01 +- TODO in 1970-01-01 diff --git a/tests/lint-resources/missing-id/TODOs.md b/tests/lint-resources/missing-id/TODOs.md new file mode 100644 index 0000000..e8a02d4 --- /dev/null +++ b/tests/lint-resources/missing-id/TODOs.md @@ -0,0 +1,4 @@ +# Tasks + +## TODO A task +- TODO in 1970-01-01 diff --git a/tests/lint-resources/out-of-order-sections/TODOs.md b/tests/lint-resources/out-of-order-sections/TODOs.md new file mode 100644 index 0000000..4c8be72 --- /dev/null +++ b/tests/lint-resources/out-of-order-sections/TODOs.md @@ -0,0 +1,16 @@ +# Tasks + +## TODO A task {#td-c001e2be-5178-4588-a592-0bd1e417b04a} +- TODO in 1970-01-01 + + +# Improvements + +## TODO An improvement {#td-d8ab4286-73f8-4407-b4af-b49240725958} +- TODO in 1970-01-01 + + +# Bugs +## TODO A bug {#td-5c6cfc09-5c36-44a0-8352-f2292081eb9d} +- TODO in 1970-01-01 + diff --git a/tests/lint-resources/scattered-known-sections/TODOs.md b/tests/lint-resources/scattered-known-sections/TODOs.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/lint-resources/scattered-known-sections/TODOs.md diff --git a/tests/lint-resources/with-no-known-sections/TODOs.md b/tests/lint-resources/with-no-known-sections/TODOs.md new file mode 100644 index 0000000..5a6234b --- /dev/null +++ b/tests/lint-resources/with-no-known-sections/TODOs.md @@ -0,0 +1,9 @@ +# An Unknown Section + +Some text + + +# Another Section + +## TODO A td-looking subsection {#td-cb99b121-f833-47ec-973c-1e256dfc617d} +- TODO in 1970-01-01 diff --git a/tests/lint-resources/with-some-known-sections/TODOs.md b/tests/lint-resources/with-some-known-sections/TODOs.md new file mode 100644 index 0000000..e78fa12 --- /dev/null +++ b/tests/lint-resources/with-some-known-sections/TODOs.md @@ -0,0 +1,14 @@ +# An Unknown Section + +## DONE This looks like an entry {#td-d55c0579-14e4-469b-853a-b15a6580e013} +- DONE in 1970-01-01 +- TODO in 2000-01-01 + + But isn't. + +# Bugs + +## DONE A real td entry {#td-47c10e6d-25bd-481b-8a54-88c6d66a44d1} +- TODO in 1970-01-01 + +# Another unknown section diff --git a/tests/linting.sh b/tests/linting.sh new file mode 100755 index 0000000..b18c0f6 --- /dev/null +++ b/tests/linting.sh @@ -0,0 +1,22 @@ +#!/bin/sh +set -u + +. tests/lib.sh + +TD='../../../src/td' +for d in tests/lint-resources/*; do + testing "lint of $d" + cd "$d" + + N="$LINENO" + OUT="$(mkstemp)" + ERR="$(mkstemp)" + LANG=POSIX.UTF-8 "$TD" -L 1>"$OUT" 2>"$ERR" + STATUS=$? + assert_status "$(cat status.txt 2>/dev/null || echo 0)" + assert_empty_stdout + assert_stderr "$(cat err.txt 2>/dev/null)" + + cd - >/dev/null + test_ok +done |