-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
38 lines (31 loc) · 911 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*!
* line-count <https://github.com/jonschlinkert/line-count>
*
* Copyright (c) 2014 Jon Schlinkert, contributors.
* Licensed under the MIT License
*/
'use strict';
var assert = require('assert');
var count = require('./');
describe('count', function () {
it('should return zero when the string is empty.', function () {
var actual = count('');
assert.equal(actual, 0);
});
it('should count lines', function () {
var actual = count('a\nb\nc');
assert.equal(actual, 3);
});
it('should include trailing newlines', function () {
var actual = count('a\nb\nc\n');
assert.equal(actual, 4);
});
it('should work with carriage returns', function () {
var actual = count('a\r\nb\r\nc');
assert.equal(actual, 3);
});
it('should include trailing carriage returns', function () {
var actual = count('a\r\nb\r\nc\r\n');
assert.equal(actual, 4);
});
});