Skip to content

Commit a6d6bc4

Browse files
Merge pull request #719 from NixOS/language-nix-test-NUL-quoting
language-nix: check that needsQuoting is True for NUL bytes
2 parents bb97bf4 + 1546da0 commit a6d6bc4

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

language-nix/test/hspec.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ main = hspec $ do
5454
it "if string contains spaces" $ stringIdentProperty $ \s ->
5555
any isSpace s ==> needsQuoting s
5656
it "if length is zero" $ shouldSatisfy "" needsQuoting
57+
-- c.f. https://github.com/NixOS/cabal2nix/issues/718
58+
it "if string contains a NUL byte" $ do
59+
shouldSatisfy "hello\NUL world" needsQuoting
60+
shouldSatisfy "\NUL" needsQuoting
5761

5862
describe "nix-instantiate" $ do
5963
nixInstantiate <- runIO $ do

0 commit comments

Comments
 (0)