@@ -251,3 +251,55 @@ def test_main_exclude_with_bad_table_definition_in_multi_table_request(capsys):
251251 captured = capsys .readouterr ()
252252 assert captured .error .startswith ("[*] ERROR:" )
253253 assert exit_info .value .code == 1
254+
255+
256+ def test_main_head_request (capsys ):
257+ args = ["--head" , "4" , ROBOTO_BEFORE_PATH , ROBOTO_AFTER_PATH ]
258+
259+ run (args )
260+ captured = capsys .readouterr ()
261+ res_string_list = captured .out .split ("\n " )
262+
263+ # includes a newline at the end of the last line of output
264+ # which makes the total # of lines in the list == n + 1
265+ assert len (res_string_list ) == 5
266+
267+ # have to handle the tests for the top two file path lines
268+ # differently than the rest of the comparisons because
269+ # the time is defined using local platform settings
270+ # which makes tests fail on different remote CI testing services
271+ for x , line in enumerate (res_string_list ):
272+ # treat top two lines of the diff as comparison of first 10 chars only
273+ if x in (0 , 1 ):
274+ assert "tests/testfiles/Roboto-Regular.subset" in line
275+ elif x == 2 :
276+ assert line == "@@ -4,34 +4,34 @@"
277+ elif x == 3 :
278+ assert line == " <GlyphOrder>"
279+ else :
280+ assert line == ""
281+
282+
283+ def test_main_tail_request (capsys ):
284+ args = ["--tail" , "2" , ROBOTO_BEFORE_PATH , ROBOTO_AFTER_PATH ]
285+
286+ run (args )
287+ captured = capsys .readouterr ()
288+ res_string_list = captured .out .split ("\n " )
289+
290+ # includes a newline at the end of the last line of output
291+ # which makes the total # of lines in the list == n + 1
292+ assert len (res_string_list ) == 3
293+
294+ # have to handle the tests for the top two file path lines
295+ # differently than the rest of the comparisons because
296+ # the time is defined using local platform settings
297+ # which makes tests fail on different remote CI testing services
298+ for x , line in enumerate (res_string_list ):
299+ # treat top two lines of the diff as comparison of first 10 chars only
300+ if x == 0 :
301+ assert line == " </Lookup>"
302+ elif x == 1 :
303+ assert line == " </LookupList>"
304+ else :
305+ assert line == ""
0 commit comments