@@ -73,6 +73,21 @@ def test_check_git_filemode_passing(tmpdir):
73
73
assert check_executables_have_shebangs ._check_git_filemode (files ) == 0
74
74
75
75
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
+
76
91
def test_check_git_filemode_failing (tmpdir ):
77
92
with tmpdir .as_cwd ():
78
93
cmd_output ('git' , 'init' , '.' )
@@ -87,6 +102,16 @@ def test_check_git_filemode_failing(tmpdir):
87
102
assert check_executables_have_shebangs ._check_git_filemode (files ) == 1
88
103
89
104
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
+
90
115
@pytest .mark .parametrize (
91
116
('content' , 'mode' , 'expected' ),
92
117
(
0 commit comments