diff options
author | defanor <defanor@uberspace.net> | 2017-12-04 07:28:42 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2017-12-04 07:28:42 +0300 |
commit | 967ae182b0a6852cc37e77cb88ee53a53526f027 (patch) | |
tree | 730395d2dbd046311300af3ac3b654ed0e18f3db /test | |
parent | 95c890dbcd07b7355399e122191a362714cd52b9 (diff) |
Be more strict on record selector name parsing
Ambiguity is possible if the parser accepts those optionally, so it
should accept them depending on the provided options.
Diffstat (limited to 'test')
-rw-r--r-- | test/Test.hs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/test/Test.hs b/test/Test.hs index a467ceb..d5860d4 100644 --- a/test/Test.hs +++ b/test/Test.hs @@ -96,6 +96,14 @@ instance ArgParser RecursiveRecordMaybe2 instance ToArgs RecursiveRecordMaybe2 instance Arbitrary RecursiveRecordMaybe2 where arbitrary = genericArbitraryU +data RecordStrings = RecordStrings + { s1 :: String + , s2 :: String + , s3 :: String + } deriving (Generic, Eq, Show) +instance ArgParser RecordStrings +instance ToArgs RecordStrings +instance Arbitrary RecordStrings where arbitrary = genericArbitraryU printAndParse :: (ArgParser a, ToArgs a, Eq a) => Modifiers -> Proxy a -> a -> Bool @@ -123,14 +131,15 @@ idEqToAndFrom m = testGroup "id == parse . print" , mkTest m (Proxy :: Proxy NestedSum) "NestedSum" , mkTest m (Proxy :: Proxy RecursiveRecordMaybe) "RecursiveRecordMaybe" , mkTest m (Proxy :: Proxy RecursiveRecordMaybe2) "RecursiveRecordMaybe2" + , mkTest m (Proxy :: Proxy RecordStrings) "RecordStrings" ] variousModifiers :: (Modifiers -> TestTree) -> TestTree variousModifiers tt = testGroup "Various modifiers" - [ testGroup "alwaysAddSelName = True" - [tt defMod { alwaysAddSelName = True }] - , testGroup "alwaysAddSelName = False" - [tt defMod { alwaysAddSelName = False }] + [ testGroup "alwaysUseSelName = True" + [tt defMod { alwaysUseSelName = True }] + , testGroup "alwaysUseSelName = False" + [tt defMod { alwaysUseSelName = False }] ] qcProps :: TestTree |