mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-09-11 16:16:09 +03:00
Add fuzz test
This commit is contained in:
parent
2a0cc68767
commit
a9eef34293
@ -1,4 +1,4 @@
|
||||
module Review.FilePattern exposing (FilePattern, compact, exclude, excludeFolder, include, match)
|
||||
module Review.FilePattern exposing (FilePattern, compact, exclude, excludeFolder, include, match, toStrings)
|
||||
|
||||
import Glob exposing (Glob)
|
||||
|
||||
@ -44,6 +44,11 @@ compact filePatterns =
|
||||
}
|
||||
|
||||
|
||||
toStrings : Summary -> List { string : String, included : Bool }
|
||||
toStrings summary =
|
||||
[]
|
||||
|
||||
|
||||
type AccumulatorType
|
||||
= IncludeAcc
|
||||
| ExcludeAcc
|
||||
|
@ -1,14 +1,16 @@
|
||||
module Review.FilePatternTest exposing (all)
|
||||
|
||||
import Expect
|
||||
import Review.FilePattern as FilePattern exposing (FilePattern)
|
||||
import Test exposing (Test, describe, test)
|
||||
import Fuzz
|
||||
import Review.FilePattern as FilePattern exposing (FilePattern, include)
|
||||
import Test exposing (Test, describe, fuzz, test)
|
||||
|
||||
|
||||
all : Test
|
||||
all =
|
||||
describe "Review.FilePattern"
|
||||
[ matchTest
|
||||
, toStringsTest
|
||||
]
|
||||
|
||||
|
||||
@ -90,3 +92,28 @@ matchAgainst filePatterns str =
|
||||
|
||||
Err globs ->
|
||||
Debug.todo ("Invalid globs:\n" ++ String.join "\n" globs)
|
||||
|
||||
|
||||
toStringsTest : Test
|
||||
toStringsTest =
|
||||
fuzz (Fuzz.list (Fuzz.map2 Tuple.pair Fuzz.string Fuzz.bool)) "toStrings" <|
|
||||
\list ->
|
||||
case
|
||||
list
|
||||
|> List.map
|
||||
(\( str, included ) ->
|
||||
if included then
|
||||
FilePattern.include str
|
||||
|
||||
else
|
||||
FilePattern.exclude str
|
||||
)
|
||||
|> FilePattern.compact
|
||||
of
|
||||
Ok patterns ->
|
||||
patterns
|
||||
|> FilePattern.toStrings
|
||||
|> Expect.equal []
|
||||
|
||||
Err _ ->
|
||||
Expect.pass
|
||||
|
Loading…
Reference in New Issue
Block a user