1
0
Fork 0

Merging upstream version 1.5.5.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-12 21:24:11 +01:00
parent ad8566cf56
commit acf6d4dbc3
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
6 changed files with 110 additions and 13 deletions

View file

@ -217,6 +217,66 @@ def test_file_is_text_does_not_exist(tmpdir):
(b"#!/path'with/quotes y", ("/path'with/quotes", 'y')),
# Don't regress on leading/trailing ws
(b"#! /path'with/quotes y ", ("/path'with/quotes", 'y')),
# Test nix-shell specialites with shebang on second line
(
b'#! /usr/bin/env nix-shell\n'
b'#! nix-shell -i bash -p python',
('bash',),
),
(
b'#! /usr/bin/env nix-shell\n'
b'#! nix-shell -i python -p coreutils',
('python',),
),
(
b'#! /usr/bin/env nix-shell\n'
b'#! nix-shell -p coreutils -i python',
('python',),
),
# multi-line and no whitespace variation
(
b'#! /usr/bin/env nix-shell\n'
b'#! nix-shell -p coreutils\n'
b'#! nix-shell -i python',
('python',),
),
(
b'#! /usr/bin/env nix-shell\n'
b'#!nix-shell -p coreutils\n'
b'#!nix-shell -i python',
('python',),
),
(
b'#! /usr/bin/env nix-shell\n'
b'#!\xf9\x93\x01\x42\xcd',
('nix-shell',),
),
(
b'#! /usr/bin/env nix-shell\n'
b'#!\x00\x00\x00\x00',
('nix-shell',),
),
# non-proper nix-shell
(b'#! /usr/bin/nix-shell', ('/usr/bin/nix-shell',)),
(b'#! /usr/bin/env nix-shell', ('nix-shell',)),
(
b'#! /usr/bin/env nix-shell non-portable-argument',
('nix-shell', 'non-portable-argument'),
),
(
b'#! /usr/bin/env nix-shell\n'
b'#! nix-shell -i',
('nix-shell',), # guard against index error
),
# interpret quotes correctly
(
b'#!/usr/bin/env nix-shell\n'
b'#!nix-shell --argstr x "a -i python3 p"\n'
b'#!nix-shell -p hello\n'
b'#!nix-shell -i bash\n'
b'#!nix-shell --argstr y "b -i runhaskell q"',
('bash',),
),
(b'\xf9\x93\x01\x42\xcd', ()),
(b'#!\xf9\x93\x01\x42\xcd', ()),
(b'#!\x00\x00\x00\x00', ()),