File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
language-nix/src/Language/Nix Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,15 @@ instance NFData Identifier where
5151 rnf (Identifier str) = rnf str
5252
5353instance Arbitrary Identifier where
54- arbitrary = Identifier <$> listOf1 (arbitraryUnicodeChar `suchThat` (/= '\ 0 '))
54+ arbitrary = Identifier <$> oneof
55+ [ -- almost always needs quoting, unreasonable
56+ listOf1 (nonNul arbitraryUnicodeChar)
57+ -- almost always needs quoting, reasonable-ish
58+ , listOf1 (nonNul arbitraryPrintableChar)
59+ -- rarely needs quoting
60+ , listOf1 (arbitraryASCIIChar `suchThat` isSimpleChar) ]
61+ where nonNul g = g `suchThat` (/= '\ 0 ')
62+ isSimpleChar c = isAlphaNum c || c `elem` " _-'"
5563 shrink (Identifier i) = map Identifier (shrink i)
5664
5765instance CoArbitrary Identifier
You can’t perform that action at this time.
0 commit comments