UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

28 lines (26 loc) 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const chai_1 = require("chai"); const textSeek_1 = require("./../../../manipulation/textSeek"); describe("getPosAfterPreviousNonBlankLine", () => { function doTest(fileText, pos, expectedPos) { chai_1.expect(textSeek_1.getPosAfterPreviousNonBlankLine(fileText, pos)).to.equal(expectedPos); } it("should get the start line pos after previous non blank line", () => { let code = "text \r\n"; const expectedPos = code.length; code += " \r\n \r\n \n\t \r\n"; const pos = code.length; code += "more"; doTest(code, pos, expectedPos); }); it("should get the start of the text if it keeps finding blank lines", () => { const expectedPos = 0; let code = "\r\n"; code += " \r\n \r\n \n\t \r\n"; const pos = code.length; code += "more"; doTest(code, pos, expectedPos); }); }); //# sourceMappingURL=getPosAfterPreviousNonBlankLineTests.js.map