* 👷 CI for jetbrains * default working dir * changelog * build binaries * binary testing setup * idesettings * core binary testing * run binary tests in ci * remove unused targets * needs build * console.log bin contents * fix ci * fix win32 binary download * test * no linux arm64 * macos latest * macos-12 * binary permissions * upload logs * fix * upload full folder as binary artifact * test * test macos only * set full execute permissions * copy sqlite binary * cd * it worked! * build again in test job * debug * remove timeout * info * log * log2 * more logs * catch * fewer logs * test all platforms * test downloaded artifact * needs build * updates * build * false * release * add tag and upload binaryes * change tag name * proper artifact upload * jest updates * ✅ generate a few unit tests with Continue * fix imports related to IdeSettings * run tsc on PRs * remove shareSession command (unused) * update release process * update plugin version * don't show ghost text when jetbrains completion visible * run jetbrains ci in main
76 lines
2.6 KiB
TypeScript
76 lines
2.6 KiB
TypeScript
// File generated by Continue
|
|
import { dedentAndGetCommonWhitespace } from "../../util";
|
|
|
|
describe("dedentAndGetCommonWhitespace", () => {
|
|
let originalString: string;
|
|
|
|
beforeEach(() => {
|
|
// Setup any global variables or states if needed
|
|
originalString = " line1\n line2\n line3";
|
|
});
|
|
|
|
afterEach(() => {
|
|
// Tear down any changes to global variables or states if needed
|
|
originalString = "";
|
|
});
|
|
|
|
test("should dedent and return common whitespace for a simple case", () => {
|
|
const input = " line1\n line2\n line3";
|
|
const output = dedentAndGetCommonWhitespace(input);
|
|
expect(output).toEqual(["line1\nline2\nline3", " "]);
|
|
});
|
|
|
|
test("should handle empty string", () => {
|
|
const input = "";
|
|
const output = dedentAndGetCommonWhitespace(input);
|
|
expect(output).toEqual(["", ""]);
|
|
});
|
|
|
|
test("should handle string with only whitespace", () => {
|
|
const input = " ";
|
|
const output = dedentAndGetCommonWhitespace(input);
|
|
expect(output).toEqual(["", ""]);
|
|
});
|
|
|
|
test("should handle string with mixed whitespace and content", () => {
|
|
const input = " line1\n line2\n line3";
|
|
const output = dedentAndGetCommonWhitespace(input);
|
|
expect(output).toEqual([" line1\nline2\n line3", " "]);
|
|
});
|
|
|
|
test("should handle string with no common leading whitespace", () => {
|
|
const input = "line1\n line2\n line3";
|
|
const output = dedentAndGetCommonWhitespace(input);
|
|
expect(output).toEqual([input, ""]);
|
|
});
|
|
|
|
test("should handle string with empty lines", () => {
|
|
const input = " line1\n\n line3";
|
|
const output = dedentAndGetCommonWhitespace(input);
|
|
expect(output).toEqual(["line1\n\nline3", " "]);
|
|
});
|
|
|
|
test("should handle string with only empty lines", () => {
|
|
const input = "\n\n";
|
|
const output = dedentAndGetCommonWhitespace(input);
|
|
expect(output).toEqual(["\n\n", ""]);
|
|
});
|
|
|
|
test("should handle string with tabs as whitespace", () => {
|
|
const input = "\tline1\n\tline2\n\tline3";
|
|
const output = dedentAndGetCommonWhitespace(input);
|
|
expect(output).toEqual(["line1\nline2\nline3", "\t"]);
|
|
});
|
|
|
|
test("should handle string with mixed tabs and spaces", () => {
|
|
const input = "\t line1\n\t line2\n\t line3";
|
|
const output = dedentAndGetCommonWhitespace(input);
|
|
expect(output).toEqual(["line1\nline2\nline3", "\t "]);
|
|
});
|
|
|
|
test("should handle string with different leading whitespace lengths", () => {
|
|
const input = " line1\n line2\n line3";
|
|
const output = dedentAndGetCommonWhitespace(input);
|
|
expect(output).toEqual([" line1\nline2\n line3", " "]);
|
|
});
|
|
});
|