github.com/jd-ly/cmd@v1.0.10/revel/test_test.go (about) 1 package main_test 2 3 import ( 4 "github.com/jd-ly/cmd/model" 5 "github.com/jd-ly/cmd/revel" 6 "github.com/stretchr/testify/assert" 7 "os" 8 "testing" 9 ) 10 11 12 // test the commands 13 func TestRevelTest(t *testing.T) { 14 a := assert.New(t) 15 gopath := setup("revel-test-test", a) 16 17 t.Run("Test", func(t *testing.T) { 18 a := assert.New(t) 19 c := newApp("test-test", model.NEW, nil, a) 20 a.Nil(main.Commands[model.NEW].RunWith(c), "Failed to run test-test") 21 c.Index = model.TEST 22 c.Test.ImportPath = c.ImportPath 23 a.Nil(main.Commands[model.TEST].RunWith(c), "Failed to run test-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 }