@@ -96,6 +96,13 @@ def test_new_features(self):
9696 ('10s' , b'helloworld' , b'helloworld' , b'helloworld' , 0 ),
9797 ('11s' , b'helloworld' , b'helloworld\0 ' , b'helloworld\0 ' , 1 ),
9898 ('20s' , b'helloworld' , b'helloworld' + 10 * b'\0 ' , b'helloworld' + 10 * b'\0 ' , 1 ),
99+ ('0p' , b'helloworld' , b'' , b'' , 1 ),
100+ ('1p' , b'helloworld' , b'\x00 ' , b'\x00 ' , 1 ),
101+ ('2p' , b'helloworld' , b'\x01 h' , b'\x01 h' , 1 ),
102+ ('10p' , b'helloworld' , b'\x09 helloworl' , b'\x09 helloworl' , 1 ),
103+ ('11p' , b'helloworld' , b'\x0A helloworld' , b'\x0A helloworld' , 0 ),
104+ ('12p' , b'helloworld' , b'\x0A helloworld\0 ' , b'\x0A helloworld\0 ' , 1 ),
105+ ('20p' , b'helloworld' , b'\x0A helloworld' + 9 * b'\0 ' , b'\x0A helloworld' + 9 * b'\0 ' , 1 ),
99106 ('b' , 7 , b'\7 ' , b'\7 ' , 0 ),
100107 ('b' , - 7 , b'\371 ' , b'\371 ' , 0 ),
101108 ('B' , 7 , b'\7 ' , b'\7 ' , 0 ),
@@ -339,6 +346,7 @@ def assertStructError(func, *args, **kwargs):
339346 def test_p_code (self ):
340347 # Test p ("Pascal string") code.
341348 for code , input , expected , expectedback in [
349+ ('0p' , b'abc' , b'' , b'' ),
342350 ('p' , b'abc' , b'\x00 ' , b'' ),
343351 ('1p' , b'abc' , b'\x00 ' , b'' ),
344352 ('2p' , b'abc' , b'\x01 a' , b'a' ),
@@ -580,6 +588,7 @@ def test__sizeof__(self):
580588 self .check_sizeof ('187s' , 1 )
581589 self .check_sizeof ('20p' , 1 )
582590 self .check_sizeof ('0s' , 1 )
591+ self .check_sizeof ('0p' , 1 )
583592 self .check_sizeof ('0c' , 0 )
584593
585594 def test_boundary_error_message (self ):
0 commit comments