дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 19:25:54 +02:00
Go settings, execution, debugging and test reporting were disconnected, leaving Go projects without editable build/test fields and workspace maintenance actions. - Add project build constraints that update gopls in place, and notices on excluded files. - Add editable Go Build and Go Test configurations with directory, package and file targets, separate tool and program arguments, modules, environment, output selection and build-only execution, and pass the same settings to Delve. - Decode Go JSON test output into the results view, with subtests, failures, skips and rerun failed. Add gutter targets for benchmarks and generate directives. - Add module environment and vendoring settings, read go.work members, and offer tidy, download, sync and use from file menus. - Add file and package generate actions, and format and organize imports through gopls on Save and Reformat. - Show what a Go program prints in the debug console: Delve's debuggee shares its stdio, which no DAP event carries. - Keep the default build output out of version control, and keep configurations produced by an earlier run out of the gutter choices. Fixes #507 Fixes #237
36 рядки
1.5 KiB
TypeScript
36 рядки
1.5 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { goModuleCommand, goModuleMenu } from "./goActions";
|
|
|
|
describe("Go module commands", () => {
|
|
it("runs module operations from the selected manifest directory", () => {
|
|
for (const operation of ["tidy", "download"] as const) {
|
|
expect(goModuleCommand(operation, "/work/app/go.mod")).toMatchObject({
|
|
kind: "go",
|
|
command: "go",
|
|
args: ["mod", operation],
|
|
cwd: "/work/app",
|
|
isTest: false,
|
|
});
|
|
}
|
|
expect(goModuleCommand("sync", "/work/go.work")?.args).toEqual(["work", "sync"]);
|
|
expect(goModuleCommand("use", "/work/go.work", "./module with spaces")?.args).toEqual([
|
|
"work",
|
|
"use",
|
|
"--",
|
|
"./module with spaces",
|
|
]);
|
|
});
|
|
it("does not reinterpret invalid manifests, missing directories or NULs", () => {
|
|
expect(goModuleCommand("tidy", "/work/go.work")).toBeNull();
|
|
expect(goModuleCommand("sync", "/work/go.mod")).toBeNull();
|
|
expect(goModuleCommand("use", "/work/go.work")).toBeNull();
|
|
expect(goModuleCommand("use", "/work/go.work", "x\0y")).toBeNull();
|
|
});
|
|
it("contributes stable action ids only to applicable manifest menus", () => {
|
|
expect(goModuleMenu({ paths: ["/p/go.mod"] }).map((m) => m.action)).toEqual(["go.mod.tidy", "go.mod.download"]);
|
|
expect(goModuleMenu({ paths: ["/p/go.work"] }).map((m) => m.action)).toEqual(["go.work.sync", "go.work.use"]);
|
|
expect(goModuleMenu({ paths: ["/p/go.work", "/p/go.mod"] })).toEqual([]);
|
|
expect(goModuleMenu({ paths: ["/p/main.go"] })).toEqual([]);
|
|
});
|
|
});
|