@dozerg/end-of-line
Version:
Determine EOL based on given text and OS.
20 lines (19 loc) • 896 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const os_1 = __importDefault(require("os"));
const _1 = require("./");
describe('endOfLine', () => {
it('should return the correct EOL', () => {
expect((0, _1.endOfLine)()).toEqual(os_1.default.EOL);
expect((0, _1.endOfLine)('')).toEqual(os_1.default.EOL);
expect((0, _1.endOfLine)(' ')).toEqual(os_1.default.EOL);
expect((0, _1.endOfLine)(' abc ')).toEqual(os_1.default.EOL);
expect((0, _1.endOfLine)(' abc\n ')).toEqual('\n');
expect((0, _1.endOfLine)(' abc\r ')).toEqual('\r');
expect((0, _1.endOfLine)(' abc\r\n ')).toEqual('\r\n');
expect((0, _1.endOfLine)(' abc\n\r ')).toEqual('\n\r');
});
});