mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-12-24 02:02:29 +03:00
Remove handling of global error module name
This commit is contained in:
parent
e7972faa3f
commit
279ac055bb
@ -213,17 +213,9 @@ expectedMoreErrors moduleName expectedNumberOfErrors missingExpectedErrors =
|
||||
numberOfErrors : Int
|
||||
numberOfErrors =
|
||||
List.length missingExpectedErrors
|
||||
|
||||
what : String
|
||||
what =
|
||||
if moduleName == "GLOBAL ERROR" then
|
||||
"global errors"
|
||||
|
||||
else
|
||||
"errors for module `" ++ moduleName ++ "`"
|
||||
in
|
||||
failureMessage "RULE REPORTED LESS ERRORS THAN EXPECTED"
|
||||
("I expected to see " ++ String.fromInt expectedNumberOfErrors ++ " " ++ what ++ " but only found " ++ String.fromInt (expectedNumberOfErrors - numberOfErrors) ++ """.
|
||||
("I expected to see " ++ String.fromInt expectedNumberOfErrors ++ " errors for module `" ++ moduleName ++ "` but only found " ++ String.fromInt (expectedNumberOfErrors - numberOfErrors) ++ """.
|
||||
Here are the """ ++ String.fromInt numberOfErrors ++ """ I could not find:
|
||||
|
||||
""")
|
||||
@ -240,7 +232,7 @@ expectedMoreGlobalErrors expectedNumberOfErrors missingExpectedErrors =
|
||||
numberOfErrors =
|
||||
List.length missingExpectedErrors
|
||||
in
|
||||
failureMessage "RULE REPORTED LESS ERRORS THAN EXPECTED"
|
||||
failureMessage "RULE REPORTED LESS GLOBAL ERRORS THAN EXPECTED"
|
||||
("I expected to see " ++ String.fromInt expectedNumberOfErrors ++ " global errors but only found " ++ String.fromInt (expectedNumberOfErrors - numberOfErrors) ++ """.
|
||||
Here are the """ ++ String.fromInt numberOfErrors ++ """ I could not find:
|
||||
|
||||
|
@ -22,6 +22,7 @@ all =
|
||||
, underMayNotBeEmptyTest
|
||||
, locationNotFoundTest
|
||||
, expectedMoreErrorsTest
|
||||
, expectedMoreGlobalErrorsTest
|
||||
, tooManyErrorsTest
|
||||
, tooManyGlobalErrorsTest
|
||||
, locationIsAmbiguousInSourceCodeTest
|
||||
@ -511,24 +512,23 @@ If this helps, this is where I found the error:
|
||||
|
||||
expectedMoreErrorsTest : Test
|
||||
expectedMoreErrorsTest =
|
||||
describe "expectedMoreErrors"
|
||||
[ test "for modules" <|
|
||||
\() ->
|
||||
let
|
||||
missingErrors : List ExpectedErrorData
|
||||
missingErrors =
|
||||
[ { message = "Remove the use of `Debug` before shipping to production"
|
||||
, details = [ "Some details" ]
|
||||
, under = "Debug.log"
|
||||
}
|
||||
, { message = "Remove the use of `Debug` before shipping to production"
|
||||
, details = [ "Some details" ]
|
||||
, under = "Debug.log"
|
||||
}
|
||||
]
|
||||
in
|
||||
FailureMessage.expectedMoreErrors "MyModule" 5 missingErrors
|
||||
|> expectMessageEqual """
|
||||
test "expectedMoreErrors" <|
|
||||
\() ->
|
||||
let
|
||||
missingErrors : List ExpectedErrorData
|
||||
missingErrors =
|
||||
[ { message = "Remove the use of `Debug` before shipping to production"
|
||||
, details = [ "Some details" ]
|
||||
, under = "Debug.log"
|
||||
}
|
||||
, { message = "Remove the use of `Debug` before shipping to production"
|
||||
, details = [ "Some details" ]
|
||||
, under = "Debug.log"
|
||||
}
|
||||
]
|
||||
in
|
||||
FailureMessage.expectedMoreErrors "MyModule" 5 missingErrors
|
||||
|> expectMessageEqual """
|
||||
\u{001B}[31m\u{001B}[1mRULE REPORTED LESS ERRORS THAN EXPECTED\u{001B}[22m\u{001B}[39m
|
||||
|
||||
I expected to see 5 errors for module `MyModule` but only found 3.
|
||||
@ -537,27 +537,29 @@ Here are the 2 I could not find:
|
||||
- `Remove the use of `Debug` before shipping to production`
|
||||
- `Remove the use of `Debug` before shipping to production`
|
||||
"""
|
||||
, test "for global errors" <|
|
||||
\() ->
|
||||
let
|
||||
missingErrors : List ExpectedErrorData
|
||||
missingErrors =
|
||||
[ { message = "Remove the use of `Debug` before shipping to production"
|
||||
, details = [ "Some details" ]
|
||||
, under = ""
|
||||
}
|
||||
]
|
||||
in
|
||||
FailureMessage.expectedMoreErrors "GLOBAL ERROR" 2 missingErrors
|
||||
|> expectMessageEqual """
|
||||
\u{001B}[31m\u{001B}[1mRULE REPORTED LESS ERRORS THAN EXPECTED\u{001B}[22m\u{001B}[39m
|
||||
|
||||
I expected to see 2 global errors but only found 1.
|
||||
Here are the 1 I could not find:
|
||||
|
||||
expectedMoreGlobalErrorsTest : Test
|
||||
expectedMoreGlobalErrorsTest =
|
||||
test "expectedMoreGlobalErrors" <|
|
||||
\() ->
|
||||
let
|
||||
missingErrors : List { message : String }
|
||||
missingErrors =
|
||||
[ { message = "Remove the use of `Debug` before shipping to production" }
|
||||
, { message = "Remove the use of `Debug` before shipping to production" }
|
||||
]
|
||||
in
|
||||
FailureMessage.expectedMoreGlobalErrors 5 missingErrors
|
||||
|> expectMessageEqual """
|
||||
\u{001B}[31m\u{001B}[1mRULE REPORTED LESS GLOBAL ERRORS THAN EXPECTED\u{001B}[22m\u{001B}[39m
|
||||
|
||||
I expected to see 5 global errors but only found 3.
|
||||
Here are the 2 I could not find:
|
||||
|
||||
- `Remove the use of `Debug` before shipping to production`
|
||||
- `Remove the use of `Debug` before shipping to production`
|
||||
"""
|
||||
]
|
||||
|
||||
|
||||
tooManyErrorsTest : Test
|
||||
|
Loading…
Reference in New Issue
Block a user