# Test that a directory replacement with a mismatched module path
# produces an error. The replacement directory declares a different
# module path than the one being replaced.

! exec cue export .
stderr 'replacement directory.*has module path "example.com/other@v0", want "example.com/dep@v0"'

-- cue.mod/module.cue --
module: "example.com/main@v0"
language: version: "v0.17.0"

deps: {
	"example.com/dep@v0": {
		v: "v0.1.0"
	}
}
-- cue.mod/local-module.cue --
deps: {
	"example.com/dep@v0": {
		v: "v0.1.0"
		replaceWith: "./local_dep"
	}
}
-- main.cue --
package main

import "example.com/dep@v0:lib"

output: lib.value
-- local_dep/cue.mod/module.cue --
module: "example.com/other@v0"
language: version: "v0.9.0"
-- local_dep/lib.cue --
package lib

value: "from local directory"
-- _registry/example.com_dep_v0.1.0/cue.mod/module.cue --
module: "example.com/dep@v0"
language: version: "v0.9.0"
-- _registry/example.com_dep_v0.1.0/lib.cue --
package lib

value: "from registry"
