@@ -158,3 +158,46 @@ def test_valid_unformatted_file_indentation_using_spaces(tmp_path):
158158 ]
159159 assert len (new_pass_lines ) == 1
160160 assert " pass" in new_pass_lines [0 ]
161+
162+
163+ def test_not_formatting_with_default_line_length (tmp_path ):
164+ # pylint: disable=line-too-long
165+ dummy_file = write_file (
166+ tmp_path ,
167+ "script.gd" ,
168+ "var x = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1\n " ,
169+ )
170+ outcome = subprocess .run (
171+ ["gdformat" , "--check" , dummy_file ], check = False , capture_output = True
172+ )
173+ assert outcome .returncode == 0
174+ assert len (outcome .stdout .decode ().splitlines ()) == 1
175+ assert len (outcome .stderr .decode ().splitlines ()) == 0
176+
177+
178+ def test_formatting_with_default_line_length (tmp_path ):
179+ # pylint: disable=line-too-long
180+ dummy_file = write_file (
181+ tmp_path ,
182+ "script.gd" ,
183+ "var x = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1\n " ,
184+ )
185+ outcome = subprocess .run (
186+ ["gdformat" , "--check" , dummy_file ], check = False , capture_output = True
187+ )
188+ assert outcome .returncode == 1
189+
190+
191+ def test_formatting_with_line_length_passed_as_argument (tmp_path ):
192+ # pylint: disable=line-too-long
193+ dummy_file = write_file (
194+ tmp_path ,
195+ "script.gd" ,
196+ "var x = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1\n " ,
197+ )
198+ outcome = subprocess .run (
199+ ["gdformat" , "--check" , "--line-length=80" , dummy_file ],
200+ check = False ,
201+ capture_output = True ,
202+ )
203+ assert outcome .returncode == 1
0 commit comments