Skip to content

Commit

Permalink
fix: ut
Browse files Browse the repository at this point in the history
  • Loading branch information
panshuai111 committed Aug 10, 2023
1 parent f84601b commit e67af01
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/cmd/compile/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
)

func TestNewCmdCompile(t *testing.T) {
m1 := mockey.Mock((*CompileOptions).Complete).To(func(o *CompileOptions, args []string) {
m1 := mockey.Mock((*CompileOptions).Complete).To(func(o *CompileOptions, args []string) error {
o.Output = "stdout"
return nil
}).Build()
m2 := mockey.Mock((*CompileOptions).Run).To(func(*CompileOptions) error {
return nil
Expand Down
5 changes: 4 additions & 1 deletion pkg/cmd/compile/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ func (o *CompileOptions) PreSet(preCheck func(cur string) bool) error {
if o.Output == "" {
absCiTestDir := filepath.Join(curDir, projectstack.CiTestDir)
_, err := os.Stat(absCiTestDir)
if err != nil && os.IsNotExist(err) {
if err != nil {
if !os.IsNotExist(err) {
return err
}
_ = os.Mkdir(absCiTestDir, 0o750)
}
o.Output = filepath.Join(projectstack.CiTestDir, projectstack.StdoutGoldenFile)
Expand Down

0 comments on commit e67af01

Please sign in to comment.