MCPcopy Create free account
hub / github.com/bufbuild/buf / TestWorkspaceNestedArchive

Function TestWorkspaceNestedArchive

cmd/buf/workspace_test.go:309–358  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

307}
308
309func TestWorkspaceNestedArchive(t *testing.T) {
310 // Archive that defines a workspace in a sub-directory to the root.
311 t.Parallel()
312 for _, dirPath := range []string{
313 "nested",
314 "v2/nested",
315 } {
316 zipDir := createZipFromDir(
317 t,
318 filepath.Join("testdata", "workspace", "success", dirPath),
319 "archive.zip",
320 )
321 testRunStdout(
322 t,
323 nil,
324 0,
325 ``,
326 "build",
327 filepath.Join(zipDir, "archive.zip#subdir=proto/internal"),
328 )
329 testRunStdout(
330 t,
331 nil,
332 0,
333 filepath.FromSlash(`proto/internal/internal.proto`),
334 "ls-files",
335 filepath.Join(zipDir, "archive.zip#subdir=proto/internal"),
336 )
337 testRunStdout(
338 t,
339 nil,
340 bufctl.ExitCodeFileAnnotation,
341 filepath.FromSlash(`proto/internal/internal.proto:3:1:Files with package "internal" must be within a directory "internal" relative to root but were in directory ".".
342 proto/internal/internal.proto:3:1:Package name "internal" should be suffixed with a correctly formed version, such as "internal.v1".`),
343 "lint",
344 filepath.Join(zipDir, "archive.zip#subdir=proto/internal"),
345 )
346 testRunStdout(
347 t,
348 nil,
349 bufctl.ExitCodeFileAnnotation,
350 filepath.FromSlash(`proto/internal/internal.proto:3:1:Files with package "internal" must be within a directory "internal" relative to root but were in directory ".".
351 proto/internal/internal.proto:3:1:Package name "internal" should be suffixed with a correctly formed version, such as "internal.v1".`),
352 "lint",
353 filepath.Join(zipDir, "archive.zip#subdir=proto/internal"),
354 "--path",
355 filepath.Join("internal.proto"),
356 )
357 }
358}
359
360func TestWorkspaceDetached(t *testing.T) {
361 t.Parallel()

Callers

nothing calls this directly

Calls 2

createZipFromDirFunction · 0.85
testRunStdoutFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…