cmd/cue: add testscript for `exp gengotypes` output filenames
Generated code is placed in cue_types_${pkgname}_gen.go files
in each CUE package directory, where the package name is omitted
from the filename if it is implied by the import path.
Document and test this behavior properly, which we did not do before.
The behavior changed with https://cuelang.org/cl/1216532,
but it actually changed for the better; our code was slightly broken
before as we did not test all edge cases.
Note that we don't want to rely on the directory name when a package
exists outside of a module, because such a package has no import path,
and the directory name is irrelevant as far as CUE is concerned.
Closes #3765.
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I17ad3471aee89a4d949e7304f20249d40be60c11
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1216895
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Jonathan Matthews <github@hello.jonathanmatthews.com>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>