diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-08-12 10:36:51 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-08-12 10:36:51 -0400 |
commit | 7f9940c1f4a6a533c1d5e7cd7980419f59524ff3 (patch) | |
tree | 3e05d15a1a0544f19713d99a4d513febe8c3c8d7 /Types | |
parent | e588f9e1597aadfaf881b9a4b15007bd41479eed (diff) |
fix test suite fail in LANG=C
This was caused by 88aeb849f620a13da47508045daae461a223c997
an Arbitrary String is not necessarily encoded using the filesystem
encoding, and in a non-utf8 locale, encodeBS throws an exception on such a
string. All I could think to do is limit test data to ascii.
This shouldn't be a problem in practice, because the all Strings in
git-annex that are not generated by Arbitrary should be loaded in a way
that does apply the filesystem encoding.
Diffstat (limited to 'Types')
-rw-r--r-- | Types/MetaData.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Types/MetaData.hs b/Types/MetaData.hs index 1e8fb4aa2..cf2811b22 100644 --- a/Types/MetaData.hs +++ b/Types/MetaData.hs @@ -270,10 +270,16 @@ instance Arbitrary MetaData where legal k _v = legalField $ fromMetaField k instance Arbitrary MetaValue where - arbitrary = MetaValue <$> arbitrary <*> arbitrary + arbitrary = MetaValue + <$> arbitrary + -- Avoid non-ascii metavalues because fully arbitrary + -- strings may not be encoded using the filesystem + -- encoding, which is norally applied to all input. + <*> arbitrary `suchThat` all isAscii instance Arbitrary MetaField where - arbitrary = MetaField . CI.mk <$> arbitrary `suchThat` legalField + arbitrary = MetaField . CI.mk + <$> arbitrary `suchThat` legalField prop_metadata_sane :: MetaData -> MetaField -> MetaValue -> Bool prop_metadata_sane m f v = and |