parser-combinator
Version:
Parser combinators
85 lines (72 loc) • 2.65 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _index = require('../../lib/stream/index');
var _index2 = _interopRequireDefault(_index);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/*
======== A Handy Little Nodeunit Reference ========
https://github.com/caolan/nodeunit
Test methods:
test.expect(numAssertions)
test.done()
Test assertions:
test.ok(value, [message])
test.equal(actual, expected, [message])
test.notEqual(actual, expected, [message])
test.deepEqual(actual, expected, [message])
test.notDeepEqual(actual, expected, [message])
test.strictEqual(actual, expected, [message])
test.notStrictEqual(actual, expected, [message])
test.throws(block, [error], [message])
test.doesNotThrow(block, [error], [message])
test.ifError(value)
*/
exports.default = {
setUp: function setUp(done) {
done();
},
'endOfStream for empty stream': function endOfStreamForEmptyStream(test) {
test.expect(1);
// tests here
test.ok(_index2.default.ofString('').endOfStream(0), 'should be endOfStream.');
test.done();
},
'endOfStream for non empty stream': function endOfStreamForNonEmptyStream(test) {
test.expect(1);
// tests here
test.ok(_index2.default.ofString('1').endOfStream(1), 'should be endOfStream.');
test.done();
},
'no endOfStream for non empty stream': function noEndOfStreamForNonEmptyStream(test) {
test.expect(1);
// tests here
test.equal(_index2.default.ofString('1').endOfStream(0), false, 'should be endOfStream.');
test.done();
},
'get from stream': function getFromStream(test) {
test.expect(1);
// tests here
test.equal(_index2.default.ofString('1').get(0).isSuccess(), true, 'should be a success.');
test.done();
},
'do not get from empty stream': function doNotGetFromEmptyStream(test) {
test.expect(1);
// tests here
test.equal(_index2.default.ofString('1').get(1).isSuccess(), false, 'should be a failure.');
test.done();
},
'do not get from erroneous stream': function doNotGetFromErroneousStream(test) {
test.expect(1);
// tests here
test.equal(_index2.default.ofString({
length: 1,
charAt: function charAt() {
throw new Error();
}
}).get(0).isSuccess(), false, 'should be a failure.');
test.done();
}
};
//# sourceMappingURL=stream_test.js.map