@@ -41,28 +41,28 @@ suite('JerryProtocolHandler', () => {
41
41
42
42
test ( 'allows otherwise valid message to be too long' , ( ) => {
43
43
delegate . onError . resetHistory ( ) ;
44
- const array = Uint8Array . from ( [ 0 , 200 , 4 , 1 , 2 , 0 ] ) ;
44
+ const array = Uint8Array . from ( [ 0 , 200 , 4 , 1 , SP . JERRY_DEBUGGER_VERSION , 0 ] ) ;
45
45
handler . onConfiguration ( array ) ;
46
46
assert ( delegate . onError . notCalled ) ;
47
47
} ) ;
48
48
49
49
test ( 'aborts when compressed pointer wrong size' , ( ) => {
50
50
delegate . onError . resetHistory ( ) ;
51
- const array = Uint8Array . from ( [ 0 , 200 , 6 , 1 , 2 ] ) ;
51
+ const array = Uint8Array . from ( [ 0 , 200 , 6 , 1 , SP . JERRY_DEBUGGER_VERSION ] ) ;
52
52
handler . onConfiguration ( array ) ;
53
53
assert ( delegate . onError . calledOnce ) ;
54
54
} ) ;
55
55
56
56
test ( 'aborts when version unexpected' , ( ) => {
57
57
delegate . onError . resetHistory ( ) ;
58
- const array = Uint8Array . from ( [ 0 , 200 , 4 , 1 , 3 ] ) ;
58
+ const array = Uint8Array . from ( [ 0 , 200 , 4 , 1 , 0 ] ) ;
59
59
handler . onConfiguration ( array ) ;
60
60
assert ( delegate . onError . calledOnce ) ;
61
61
} ) ;
62
62
63
63
test ( 'succeeds when everything is normal' , ( ) => {
64
64
delegate . onError . resetHistory ( ) ;
65
- const array = Uint8Array . from ( [ 0 , 200 , 4 , 1 , 2 ] ) ;
65
+ const array = Uint8Array . from ( [ 0 , 200 , 4 , 1 , SP . JERRY_DEBUGGER_VERSION ] ) ;
66
66
handler . onConfiguration ( array ) ;
67
67
assert ( delegate . onError . notCalled ) ;
68
68
} ) ;
@@ -281,9 +281,9 @@ suite('JerryProtocolHandler', () => {
281
281
( handler as any ) . evalResultData = undefined ;
282
282
( handler as any ) . evalsPending = 1 ;
283
283
handler . onEvalResult ( Uint8Array . from ( [ SP . SERVER . JERRY_DEBUGGER_EVAL_RESULT_END ,
284
- 'a' . charCodeAt ( 0 ) , 'b' . charCodeAt ( 0 ) , SP . EVAL_SUBTYPE . JERRY_DEBUGGER_EVAL_OK ] ) ) ;
284
+ 'a' . charCodeAt ( 0 ) , 'b' . charCodeAt ( 0 ) , SP . EVAL_RESULT_SUBTYPE . JERRY_DEBUGGER_EVAL_OK ] ) ) ;
285
285
assert ( delegate . onEvalResult . calledOnce ) ;
286
- assert . strictEqual ( delegate . onEvalResult . args [ 0 ] [ 0 ] , SP . EVAL_SUBTYPE . JERRY_DEBUGGER_EVAL_OK ) ;
286
+ assert . strictEqual ( delegate . onEvalResult . args [ 0 ] [ 0 ] , SP . EVAL_RESULT_SUBTYPE . JERRY_DEBUGGER_EVAL_OK ) ;
287
287
assert . strictEqual ( delegate . onEvalResult . args [ 0 ] [ 1 ] , 'ab' ) ;
288
288
assert . strictEqual ( ( handler as any ) . evalResultData , undefined ) ;
289
289
assert . strictEqual ( ( handler as any ) . evalsPending , 0 ) ;
@@ -299,9 +299,9 @@ suite('JerryProtocolHandler', () => {
299
299
handler . onEvalResult ( Uint8Array . from ( [ SP . SERVER . JERRY_DEBUGGER_EVAL_RESULT ,
300
300
'a' . charCodeAt ( 0 ) , 'b' . charCodeAt ( 0 ) ] ) ) ;
301
301
handler . onEvalResult ( Uint8Array . from ( [ SP . SERVER . JERRY_DEBUGGER_EVAL_RESULT_END ,
302
- 'a' . charCodeAt ( 0 ) , 'b' . charCodeAt ( 0 ) , SP . EVAL_SUBTYPE . JERRY_DEBUGGER_EVAL_OK ] ) ) ;
302
+ 'a' . charCodeAt ( 0 ) , 'b' . charCodeAt ( 0 ) , SP . EVAL_RESULT_SUBTYPE . JERRY_DEBUGGER_EVAL_OK ] ) ) ;
303
303
assert ( delegate . onEvalResult . calledOnce ) ;
304
- assert . strictEqual ( delegate . onEvalResult . args [ 0 ] [ 0 ] , SP . EVAL_SUBTYPE . JERRY_DEBUGGER_EVAL_OK ) ;
304
+ assert . strictEqual ( delegate . onEvalResult . args [ 0 ] [ 0 ] , SP . EVAL_RESULT_SUBTYPE . JERRY_DEBUGGER_EVAL_OK ) ;
305
305
assert . strictEqual ( delegate . onEvalResult . args [ 0 ] [ 1 ] , 'abab' ) ;
306
306
assert . strictEqual ( ( handler as any ) . evalResultData , undefined ) ;
307
307
assert . strictEqual ( ( handler as any ) . evalsPending , 0 ) ;
@@ -329,7 +329,7 @@ suite('JerryProtocolHandler', () => {
329
329
330
330
test ( 'aborts when unhandled message sent' , ( ) => {
331
331
delegate . onError . resetHistory ( ) ;
332
- const array = Uint8Array . from ( [ SP . SERVER . JERRY_DEBUGGER_CONFIGURATION , 200 , 4 , 1 , 2 ] ) ;
332
+ const array = Uint8Array . from ( [ SP . SERVER . JERRY_DEBUGGER_CONFIGURATION , 200 , 4 , 1 , 3 ] ) ;
333
333
handler . onMessage ( array ) ;
334
334
assert ( delegate . onError . notCalled ) ;
335
335
array [ 0 ] = 255 ;
@@ -381,7 +381,7 @@ suite('JerryProtocolHandler', () => {
381
381
handler . evaluate ( 'foo' ) ;
382
382
assert ( debugClient . send . calledOnce ) ;
383
383
assert . deepStrictEqual ( debugClient . send . args [ 0 ] [ 0 ] , Uint8Array . from ( [
384
- SP . CLIENT . JERRY_DEBUGGER_EVAL , 3 , 0 , 0 , 0 ,
384
+ SP . CLIENT . JERRY_DEBUGGER_EVAL , 4 , 0 , 0 , 0 , 0 ,
385
385
'f' . charCodeAt ( 0 ) , 'o' . charCodeAt ( 0 ) , 'o' . charCodeAt ( 0 ) ,
386
386
] ) ) ;
387
387
} ) ;
@@ -398,13 +398,16 @@ suite('JerryProtocolHandler', () => {
398
398
( handler as any ) . maxMessageSize = 6 ;
399
399
( handler as any ) . debuggerClient = debugClient ;
400
400
handler . evaluate ( 'foobar' ) ;
401
- assert ( debugClient . send . calledTwice ) ;
401
+ assert ( debugClient . send . calledThrice ) ;
402
402
assert . deepStrictEqual ( debugClient . send . args [ 0 ] [ 0 ] , Uint8Array . from ( [
403
- SP . CLIENT . JERRY_DEBUGGER_EVAL , 6 , 0 , 0 , 0 , 'f' . charCodeAt ( 0 ) ,
403
+ SP . CLIENT . JERRY_DEBUGGER_EVAL , 7 , 0 , 0 , 0 , 0 ,
404
404
] ) ) ;
405
405
assert . deepStrictEqual ( debugClient . send . args [ 1 ] [ 0 ] , Uint8Array . from ( [
406
- SP . CLIENT . JERRY_DEBUGGER_EVAL_PART , 'o' . charCodeAt ( 0 ) , 'o' . charCodeAt ( 0 ) ,
407
- 'b' . charCodeAt ( 0 ) , 'a' . charCodeAt ( 0 ) , 'r' . charCodeAt ( 0 ) ,
406
+ SP . CLIENT . JERRY_DEBUGGER_EVAL_PART , 'f' . charCodeAt ( 0 ) , 'o' . charCodeAt ( 0 ) , 'o' . charCodeAt ( 0 ) ,
407
+ 'b' . charCodeAt ( 0 ) , 'a' . charCodeAt ( 0 ) ,
408
+ ] ) ) ;
409
+ assert . deepStrictEqual ( debugClient . send . args [ 2 ] [ 0 ] , Uint8Array . from ( [
410
+ SP . CLIENT . JERRY_DEBUGGER_EVAL_PART , 'r' . charCodeAt ( 0 ) ,
408
411
] ) ) ;
409
412
} ) ;
410
413
} ) ;
@@ -563,4 +566,4 @@ suite('JerryProtocolHandler', () => {
563
566
assert ( debugClient . send . withArgs ( Uint8Array . from ( [ SP . CLIENT . JERRY_DEBUGGER_NEXT ] ) ) ) ;
564
567
} ) ;
565
568
} ) ;
566
- } ) ;
569
+ } ) ;
0 commit comments