@@ -73,6 +73,21 @@ def test_check_git_filemode_passing(tmpdir):
7373 assert check_executables_have_shebangs ._check_git_filemode (files ) == 0
7474
7575
76+ def test_check_git_filemode_passing_unusual_characters (tmpdir ):
77+ with tmpdir .as_cwd ():
78+ cmd_output ('git' , 'init' , '.' )
79+
80+ f = tmpdir .join ('mañana.txt' )
81+ f .write ('#!/usr/bin/env bash' )
82+ f_path = str (f )
83+ cmd_output ('chmod' , '+x' , f_path )
84+ cmd_output ('git' , 'add' , f_path )
85+ cmd_output ('git' , 'update-index' , '--chmod=+x' , f_path )
86+
87+ files = (f_path ,)
88+ assert check_executables_have_shebangs ._check_git_filemode (files ) == 0
89+
90+
7691def test_check_git_filemode_failing (tmpdir ):
7792 with tmpdir .as_cwd ():
7893 cmd_output ('git' , 'init' , '.' )
@@ -87,6 +102,16 @@ def test_check_git_filemode_failing(tmpdir):
87102 assert check_executables_have_shebangs ._check_git_filemode (files ) == 1
88103
89104
105+ @pytest .mark .parametrize ('out' , ('\0 f1\0 f2\0 ' , '\0 f1\0 f2' , 'f1\0 f2\0 ' ))
106+ def test_check_zsplits_correctly (out ):
107+ assert check_executables_have_shebangs .zsplit (out ) == ['f1' , 'f2' ]
108+
109+
110+ @pytest .mark .parametrize ('out' , ('\0 \0 ' , '\0 ' , '' ))
111+ def test_check_zsplit_returns_empty (out ):
112+ assert check_executables_have_shebangs .zsplit (out ) == []
113+
114+
90115@pytest .mark .parametrize (
91116 ('content' , 'mode' , 'expected' ),
92117 (
0 commit comments