@@ -750,6 +750,49 @@ def test_no_semis_header_splitter(self):
750750
751751Test""" )
752752
753+ def test_last_split_chunk_does_not_fit (self ):
754+ eq = self .ndiffAssertEqual
755+ h = Header ('Subject: the first part of this is short, but_the_second'
756+ '_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line'
757+ '_all_by_itself' )
758+ eq (h .encode (), """\
759+ Subject: the first part of this is short,
760+ but_the_second_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself""" )
761+
762+ def test_splittable_leading_char_followed_by_overlong_unsplitable (self ):
763+ eq = self .ndiffAssertEqual
764+ h = Header (', but_the_second'
765+ '_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line'
766+ '_all_by_itself' )
767+ eq (h .encode (), """\
768+ ,
769+ but_the_second_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself""" )
770+
771+ def test_multiple_splittable_leading_char_followed_by_overlong_unsplitable (self ):
772+ eq = self .ndiffAssertEqual
773+ h = Header (', , but_the_second'
774+ '_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line'
775+ '_all_by_itself' )
776+ eq (h .encode (), """\
777+ , ,
778+ but_the_second_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself""" )
779+
780+ def test_trailing_splitable_on_overlong_unsplitable (self ):
781+ eq = self .ndiffAssertEqual
782+ h = Header ('this_part_does_not_fit_within_maxlinelen_and_thus_should_'
783+ 'be_on_a_line_all_by_itself;' )
784+ eq (h .encode (), "this_part_does_not_fit_within_maxlinelen_and_thus_should_"
785+ "be_on_a_line_all_by_itself;" )
786+
787+ def test_trailing_splitable_on_overlong_unsplitable_with_leading_splitable (self ):
788+ eq = self .ndiffAssertEqual
789+ h = Header ('; '
790+ 'this_part_does_not_fit_within_maxlinelen_and_thus_should_'
791+ 'be_on_a_line_all_by_itself;' )
792+ eq (h .encode (), """\
793+ ;
794+ this_part_does_not_fit_within_maxlinelen_and_thus_should_be_on_a_line_all_by_itself;""" )
795+
753796 def test_no_split_long_header (self ):
754797 eq = self .ndiffAssertEqual
755798 hstr = 'References: ' + 'x' * 80
0 commit comments