github.com/terhitormanen/cmd@v1.1.4/revel/test_test.go (about) 1 package main_test 2 3 import ( 4 "os" 5 "testing" 6 7 "github.com/stretchr/testify/assert" 8 "github.com/terhitormanen/cmd/model" 9 main "github.com/terhitormanen/cmd/revel" 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 }