cmd/entc: support custom target on codegen (#189)

Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/189

Fixes #61

Reviewed By: alexsn

Differential Revision: D18676988

fbshipit-source-id: 00d415e14d1278a45edea49c69abe4916303f55d
This commit is contained in:
Ariel Mashraki
2019-11-24 07:57:34 -08:00
committed by Facebook Github Bot
parent 67c3fd2db9
commit 0344904a4e
3 changed files with 34 additions and 17 deletions

View File

@@ -35,6 +35,11 @@ func testPkgPath(t *testing.T, x packagestest.Exporter) {
target = filepath.Join(e.Config.Dir, "z/ent")
pkgPath, err = PkgPath(e.Config, target)
require.NoError(t, err)
require.Equal(t, "golang.org/x/y/z/ent", pkgPath)
target = filepath.Join(e.Config.Dir, "z/e/n/t")
pkgPath, err = PkgPath(e.Config, target)
require.Error(t, err)
require.Empty(t, pkgPath)
}