Read the error count backwards from the bottom (after all the errors)
This commit is contained in:
+11
-14
@@ -17,9 +17,6 @@ SUBFOLDER_MISSPELLING_COUNT=1
|
||||
# From all files called example.txt
|
||||
EXAMPLE_MISSPELLING_COUNT=5
|
||||
|
||||
ERROR_COUNT_LINE_NUMBER=10
|
||||
BOOLEAN_OPTION_LINE_OFFSET=1
|
||||
|
||||
export RUNNER_TEMP="/foo/runner_temp"
|
||||
|
||||
# This function runs before every test
|
||||
@@ -58,7 +55,7 @@ function setup() {
|
||||
[ "${lines[0]}" == "::add-matcher::${RUNNER_TEMP}/_github_workflow/codespell-matcher.json" ]
|
||||
outputRegex="^Running codespell on '${INPUT_PATH}'"
|
||||
[[ "${lines[1]}" =~ $outputRegex ]]
|
||||
[ "${lines[$ERROR_COUNT_LINE_NUMBER]}" == "$errorCount" ]
|
||||
[ "${lines[-4 - $errorCount]}" == "$errorCount" ]
|
||||
[ "${lines[-3]}" == "Codespell found one or more problems" ]
|
||||
[ "${lines[-2]}" == "::remove-matcher owner=codespell-matcher-default::" ]
|
||||
[ "${lines[-1]}" == "::remove-matcher owner=codespell-matcher-specified::" ]
|
||||
@@ -71,7 +68,7 @@ function setup() {
|
||||
INPUT_CHECK_FILENAMES=true
|
||||
run "./entrypoint.sh"
|
||||
[ $status -eq $expectedExitStatus ]
|
||||
[ "${lines[$ERROR_COUNT_LINE_NUMBER+$BOOLEAN_OPTION_LINE_OFFSET]}" == "$errorCount" ]
|
||||
[ "${lines[-4 - $errorCount]}" == "$errorCount" ]
|
||||
}
|
||||
|
||||
@test "Check a hidden file" {
|
||||
@@ -82,7 +79,7 @@ function setup() {
|
||||
INPUT_PATH="./test/testdata/.hidden"
|
||||
run "./entrypoint.sh"
|
||||
[ $status -eq $expectedExitStatus ]
|
||||
[ "${lines[$ERROR_COUNT_LINE_NUMBER+$BOOLEAN_OPTION_LINE_OFFSET]}" == "$errorCount" ]
|
||||
[ "${lines[-4 - $errorCount]}" == "$errorCount" ]
|
||||
}
|
||||
|
||||
@test "Check a hidden file without INPUT_CHECK_HIDDEN set" {
|
||||
@@ -92,7 +89,7 @@ function setup() {
|
||||
INPUT_PATH="./test/testdata/.hidden"
|
||||
run "./entrypoint.sh"
|
||||
[ $status -eq $expectedExitStatus ]
|
||||
[ "${lines[$ERROR_COUNT_LINE_NUMBER]}" == "$errorCount" ]
|
||||
[ "${lines[-4 - $errorCount]}" == "$errorCount" ]
|
||||
}
|
||||
|
||||
@test "Use an exclude file" {
|
||||
@@ -102,7 +99,7 @@ function setup() {
|
||||
INPUT_EXCLUDE_FILE="./test/exclude-file.txt"
|
||||
run "./entrypoint.sh"
|
||||
[ $status -eq $expectedExitStatus ]
|
||||
[ "${lines[$ERROR_COUNT_LINE_NUMBER]}" == "$errorCount" ]
|
||||
[ "${lines[-4 - $errorCount]}" == "$errorCount" ]
|
||||
}
|
||||
|
||||
@test "Check the skip option" {
|
||||
@@ -112,7 +109,7 @@ function setup() {
|
||||
INPUT_SKIP="example.txt"
|
||||
run "./entrypoint.sh"
|
||||
[ $status -eq $expectedExitStatus ]
|
||||
[ "${lines[$ERROR_COUNT_LINE_NUMBER]}" == "$errorCount" ]
|
||||
[ "${lines[-4 - $errorCount]}" == "$errorCount" ]
|
||||
}
|
||||
|
||||
@test "Use an additional builtin dictionary" {
|
||||
@@ -122,7 +119,7 @@ function setup() {
|
||||
INPUT_BUILTIN="clear,rare,names"
|
||||
run "./entrypoint.sh"
|
||||
[ $status -eq $expectedExitStatus ]
|
||||
[ "${lines[$ERROR_COUNT_LINE_NUMBER]}" == "$errorCount" ]
|
||||
[ "${lines[-4 - $errorCount]}" == "$errorCount" ]
|
||||
}
|
||||
|
||||
@test "Use an ignore words file" {
|
||||
@@ -132,7 +129,7 @@ function setup() {
|
||||
INPUT_IGNORE_WORDS_FILE="./test/ignore-words-file.txt"
|
||||
run "./entrypoint.sh"
|
||||
[ $status -eq $expectedExitStatus ]
|
||||
[ "${lines[$ERROR_COUNT_LINE_NUMBER]}" == "$errorCount" ]
|
||||
[ "${lines[-4 - $errorCount]}" == "$errorCount" ]
|
||||
}
|
||||
|
||||
@test "Use an ignore words list" {
|
||||
@@ -142,7 +139,7 @@ function setup() {
|
||||
INPUT_IGNORE_WORDS_LIST="abandonned"
|
||||
run "./entrypoint.sh"
|
||||
[ $status -eq $expectedExitStatus ]
|
||||
[ "${lines[$ERROR_COUNT_LINE_NUMBER]}" == "$errorCount" ]
|
||||
[ "${lines[-4 - $errorCount]}" == "$errorCount" ]
|
||||
}
|
||||
|
||||
@test "Custom path" {
|
||||
@@ -152,7 +149,7 @@ function setup() {
|
||||
INPUT_PATH="./test/testdata/subfolder"
|
||||
run "./entrypoint.sh"
|
||||
[ $status -eq $expectedExitStatus ]
|
||||
[ "${lines[$ERROR_COUNT_LINE_NUMBER]}" == "$errorCount" ]
|
||||
[ "${lines[-4 - $errorCount]}" == "$errorCount" ]
|
||||
}
|
||||
|
||||
@test "Only warn" {
|
||||
@@ -162,5 +159,5 @@ function setup() {
|
||||
INPUT_ONLY_WARN=true
|
||||
run "./entrypoint.sh"
|
||||
[ $status -eq $expectedExitStatus ]
|
||||
#[ "${lines[$ERROR_COUNT_LINE_NUMBER+$BOOLEAN_OPTION_LINE_OFFSET]}" == "$errorCount" ]
|
||||
#[ "${lines[-4 - $errorCount]}" == "$errorCount" ]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user