File: connected-users-websocket/node_modules/socket.io/node_modules/redis/benches/hiredis_parser.js

Recommend this page to a friend!
  Classes of Igor Escobar   Terminal Crossword   connected-users-websocket/node_modules/socket.io/node_modules/redis/benches/hiredis_parser.js   Download  
File: connected-users-websocket/node_modules/socket.io/node_modules/redis/benches/hiredis_parser.js
Role: Example script
Content type: text/plain
Description: Example script
Class: Terminal Crossword
Generate a crosswords board on a text console
Author: By
Last change:
Date: 2 years ago
Size: 813 bytes
 

Contents

Class file image Download
var Parser = require('../lib/parser/hiredis').Parser; var assert = require('assert'); /* This test makes sure that exceptions thrown inside of "reply" event handlers are not trapped and mistakenly emitted as parse errors. */ (function testExecuteDoesNotCatchReplyCallbackExceptions() { var parser = new Parser(); var replies = [{}]; parser.reader = { feed: function() {}, get: function() { return replies.shift(); } }; var emittedError = false; var caughtException = false; parser .on('error', function() { emittedError = true; }) .on('reply', function() { throw new Error('bad'); }); try { parser.execute(); } catch (err) { caughtException = true; } assert.equal(caughtException, true); assert.equal(emittedError, false); })();