ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
35 lines (33 loc) • 1.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const textSeek_1 = require("./../../../manipulation/textSeek");
describe("getPosAtNextNonBlankLine", () => {
function doTest(fileText, pos, expectedPos) {
chai_1.expect(textSeek_1.getPosAtNextNonBlankLine(fileText, pos)).to.equal(expectedPos);
}
it("should get the start line pos at next non blank line when ending with \\r\\n", () => {
let code = "text";
const pos = code.length;
code += " \r\n \r\n \n\t \r\n\r\n";
const expectedPos = code.length;
code += "more";
doTest(code, pos, expectedPos);
});
it("should get the start line pos at next non blank line when ending with \\n", () => {
let code = "text";
const pos = code.length;
code += " \n";
const expectedPos = code.length;
code += "more";
doTest(code, pos, expectedPos);
});
it("should get the end of the text if no blank line found", () => {
let code = "text";
const pos = code.length;
code += " \r\n \r\n \n\t \r\n\r\n";
const expectedPos = code.length;
doTest(code, pos, expectedPos);
});
});
//# sourceMappingURL=getPosAtNextNonBlankLineTests.js.map