Add sequence parsing
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
module FieldSpec (main, spec) where
|
||||
|
||||
import Test.Hspec
|
||||
|
||||
import Constraint
|
||||
import Field
|
||||
|
||||
@ -20,12 +19,15 @@ spec = do
|
||||
it "fails constraints" $
|
||||
parseNumber "10" (Constraint 0 5) `shouldBe` Nothing
|
||||
|
||||
describe "Field" $ do
|
||||
it "can be created from asterisk" $
|
||||
describe "Field can be created from" $ do
|
||||
it "asterisk" $
|
||||
parseField "*" (Constraint 0 0) `shouldBe` Just (Field All Every)
|
||||
|
||||
it "can be created from number" $
|
||||
it "number" $
|
||||
parseField "10" (Constraint 0 10) `shouldBe` Just (Field (Range 10 10) Every)
|
||||
|
||||
it "can be created from range" $
|
||||
it "range" $
|
||||
parseField "10-20" (Constraint 0 59) `shouldBe` Just (Field (Range 10 20) Every)
|
||||
|
||||
it "sequence" $
|
||||
parseField "1,2,3" (Constraint 0 59) `shouldBe` Just (Field (Sequence [1, 2, 3]) Every)
|
||||
|
@ -1,7 +1,6 @@
|
||||
module HelperSpec (main, spec) where
|
||||
|
||||
import Test.Hspec
|
||||
|
||||
import Helper
|
||||
|
||||
main :: IO ()
|
||||
|
Reference in New Issue
Block a user