# When CUE_REGISTRY is correctly set, packages in the
# pkg directory will result in an error when they conflict with actual
# dependencies.

! exec cue export .
cmp stderr expect-stderr

-- expect-stderr --
test.org@v0: import failed: cannot find package "example.com/e": ambiguous import: found package example.com/e in multiple locations:
	example.com/e@v0 v0.0.1 (.)
	local (cue.mod/pkg/example.com/e):
    ./main.cue:2:8
-- main.cue --
package main
import "example.com/e"

e.foo

-- cue.mod/module.cue --
module: "test.org"
language: version: "v0.8.0"
deps: "example.com/e": v: "v0.0.1"

-- cue.mod/pkg/example.com/e/cue.mod/module.cue --
module: "example.com/e"
language: version: "v0.8.0"

-- cue.mod/pkg/example.com/e/main.cue --
package e
foo: "cue.mod/pkg source"

-- _registry/example.com_e_v0.0.1/cue.mod/module.cue --
module: "example.com/e@v0"
language: version: "v0.8.0"

-- _registry/example.com_e_v0.0.1/main.cue --
package e

foo: "registry source"
