Generate the code to parse APC escape codes

Allows it to be re-used for other APC codes
if needed.
This commit is contained in:
Kovid Goyal
2018-07-19 18:43:26 +05:30
parent 0b7abf5690
commit af9f7bb0d2
5 changed files with 480 additions and 167 deletions

View File

@@ -265,19 +265,19 @@ class TestParser(BaseTest):
pb = partial(self.parse_bytes_dump, s)
uint32_max = 2**32 - 1
t('i=%d' % uint32_max, id=uint32_max)
e('i=%d' % (uint32_max + 1), 'id is too large')
e('i=%d' % (uint32_max + 1), 'Malformed GraphicsCommand control block, number is too large')
pb('\033_Gi=12\033\\', c(id=12))
t('a=t,t=d,s=100,z=-9', payload='X', action='t', transmission_type='d', data_width=100, z_index=-9, payload_sz=1)
t('a=t,t=d,s=100,z=9', payload='payload', action='t', transmission_type='d', data_width=100, z_index=9, payload_sz=7)
t('a=t,t=d,s=100,z=9', action='t', transmission_type='d', data_width=100, z_index=9)
e(',s=1', 'Malformed graphics control block, invalid key character: 0x2c')
e('W=1', 'Malformed graphics control block, invalid key character: 0x57')
e('1=1', 'Malformed graphics control block, invalid key character: 0x31')
e('a=t,,w=2', 'Malformed graphics control block, invalid key character: 0x2c')
e('s', 'Malformed graphics control block, no = after key')
e('s=', 'Malformed graphics control block, expecting an integer value')
e('s==', 'Malformed graphics control block, expecting an integer value for key: s')
e('s=1=', 'Malformed graphics control block, expecting a comma or semi-colon after a value, found: 0x3d')
e(',s=1', 'Malformed GraphicsCommand control block, invalid key character: 0x2c')
e('W=1', 'Malformed GraphicsCommand control block, invalid key character: 0x57')
e('1=1', 'Malformed GraphicsCommand control block, invalid key character: 0x31')
e('a=t,,w=2', 'Malformed GraphicsCommand control block, invalid key character: 0x2c')
e('s', 'Malformed GraphicsCommand control block, no = after key')
e('s=', 'Malformed GraphicsCommand control block, expecting an integer value')
e('s==', 'Malformed GraphicsCommand control block, expecting an integer value for key: s')
e('s=1=', 'Malformed GraphicsCommand control block, expecting a comma or semi-colon after a value, found: 0x3d')
def test_deccara(self):
s = self.create_screen()