git.iko.soy/typeable/bloodhound
on master help sign in
Don't generate problematic geopoint names

Turns out that if you have fields from and to, that won't play nicely with geopoints. Nothing we can do but this should resolve the test error.

commitc4329933134d0f6a8c6944a223f019c140af136e authorMichael Xavier <michael@michaelxavier.net> dateSat 17 Dec 2016, 13:55 (10 years ago) parentf564d79
1 file changed+8−1
tests/tests.hs+8−1
tests/tests.hs+8−1
@@ -872,7 +872,14 @@ instance Arbitrary LessThan where arbitrary = sopArbitrary; shrink = genericShri
872872instance Arbitrary LessThanEq where arbitrary = sopArbitrary; shrink = genericShrink
873873instance Arbitrary GreaterThan where arbitrary = sopArbitrary; shrink = genericShrink
874874instance Arbitrary GreaterThanEq where arbitrary = sopArbitrary; shrink = genericShrink
875−instance Arbitrary GeoPoint where arbitrary = sopArbitrary; shrink = genericShrink
875+instance Arbitrary GeoPoint where
876+ arbitrary = GeoPoint <$> (arbitrary `suchThat` reasonableFieldName) <*> arbitrary
877+ where
878+ -- These are problematic for geopoint for obvious reasons
879+ reasonableFieldName (FieldName "from") = False
880+ reasonableFieldName (FieldName "to") = False
881+ reasonableFieldName _ = True
882+ shrink = genericShrink
876883instance Arbitrary NullValue where arbitrary = sopArbitrary; shrink = genericShrink
877884instance Arbitrary MinimumMatchHighLow where arbitrary = sopArbitrary; shrink = genericShrink
878885instance Arbitrary CommonMinimumMatch where arbitrary = sopArbitrary; shrink = genericShrink