# Fail when import path provided as argument is invalid.
! exec cue fmt ./non-existing-file
cmp stderr non-existing-file.golden

# Ignore certain package loading errors in cue fmt.
cd issue644
exec cue fmt x.cue
exec cue fmt ./...
cmp x.cue out/x_cue
cd ..

cd issue728
exec cue fmt x.cue
exec cue fmt ./...
cmp x.cue out/x_cue
cd ..

cd issue1938
exec cue fmt x.cue y.cue
cmp x.cue out/x_cue
cmp y.cue out/y_cue
cd ..

-- non-existing-file.golden --
cannot find package "./non-existing-file"
-- cue.mod/module.cue --
module: "mod.test/x"
language: version: "v0.9.0"
-- emptypkg/.empty --
-- issue644/x.cue --
package x

import   "mod.test/x/nosuchpkg"

x: 5
y: unresolved
-- issue644/out/x_cue --
package x

import "mod.test/x/nosuchpkg"

x: 5
y: unresolved
-- issue728/x.cue --
package x

import   "mod.test/x/emptypkg"

x: 5
-- issue728/out/x_cue --
package x

import "mod.test/x/emptypkg"

x: 5
-- issue1938/x.cue --
package x

import   "mod.test/x/nosuchpkg"

x: 5
-- issue1938/out/x_cue --
package x

import "mod.test/x/nosuchpkg"

x: 5
-- issue1938/y.cue --
package y

y:      6
-- issue1938/out/y_cue --
package y

y: 6
