diff --git a/test/parallel/test-debug-protocol-execute.js b/test/parallel/test-debug-protocol-execute.js new file mode 100644 index 0000000000..e87b25f5cb --- /dev/null +++ b/test/parallel/test-debug-protocol-execute.js @@ -0,0 +1,20 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); +const debug = require('_debugger'); + +const protocol = new debug.Protocol(); + +assert.strictEqual(protocol.state, 'headers'); + +protocol.execute('Content-Length: 10\r\n\r\nfhqwhgads'); + +assert.strictEqual(protocol.state, 'body'); +assert.strictEqual(protocol.res.body, undefined); + +protocol.state = 'sterrance'; +assert.throws( + () => { protocol.execute('grumblecakes'); }, + /^Error: Unknown state$/ +);