github.com/wangkui503/aero@v1.0.0/cmd/aero/main_test.go (about) 1 package main 2 3 import ( 4 "os" 5 "path" 6 "testing" 7 ) 8 9 func TestNoParameters(t *testing.T) { 10 oldPath, _ := os.Getwd() 11 defer os.Chdir(oldPath) 12 13 projectPath := path.Join(os.TempDir(), "aero-app-test") 14 15 os.Mkdir(projectPath, 0777) 16 defer os.RemoveAll(projectPath) 17 18 os.Chdir(projectPath) 19 20 main() 21 } 22 23 func TestNewApp(t *testing.T) { 24 oldPath, _ := os.Getwd() 25 defer os.Chdir(oldPath) 26 27 projectPath := path.Join(os.TempDir(), "aero-app-test") 28 29 os.Mkdir(projectPath, 0777) 30 defer os.RemoveAll(projectPath) 31 32 os.Chdir(projectPath) 33 34 os.Args = append(os.Args, "-newapp") 35 main() 36 }