github.com/wiselike/revel-cmd@v1.2.1/revel/package_test.go (about) 1 package main_test 2 3 import ( 4 "os" 5 "testing" 6 7 "github.com/wiselike/revel-cmd/model" 8 main "github.com/wiselike/revel-cmd/revel" 9 "github.com/stretchr/testify/assert" 10 ) 11 12 // test the commands. 13 func TestPackage(t *testing.T) { 14 a := assert.New(t) 15 gopath := setup("revel-test-package", a) 16 17 t.Run("Package", func(t *testing.T) { 18 a := assert.New(t) 19 c := newApp("package-test", model.NEW, nil, a) 20 a.Nil(main.Commands[model.NEW].RunWith(c), "failed to run new") 21 c.Index = model.PACKAGE 22 c.Package.ImportPath = c.ImportPath 23 a.Nil(main.Commands[model.PACKAGE].RunWith(c), "Failed to run package-test") 24 }) 25 26 if !t.Failed() { 27 if err := os.RemoveAll(gopath); err != nil { 28 a.Fail("Failed to remove test path") 29 } 30 } 31 }