Skip to content

Commit

Permalink
修补测试流程
Browse files Browse the repository at this point in the history
  • Loading branch information
yangyile committed Dec 4, 2024
1 parent 7fa3f00 commit 7964596
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions exec_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package osexec_test

import (
"os/exec"
"strings"
"testing"

Expand Down Expand Up @@ -39,6 +40,13 @@ func TestCommandConfig_ExecXshRun_WithBash(t *testing.T) {
}

func TestCommandConfig_ExecXshRun_WithZsh(t *testing.T) {
// 检测环境是否支持 zsh
path, err := exec.LookPath("zsh")
if err != nil { // 假如测试环境里没有 zsh 就会报错
t.Skip("zsh is not available on this system, skipping test case")
}
t.Log(path)

data, err := osexec.NewCommandConfig().WithZsh().Exec("echo", "$HOME")
require.NoError(t, err)
t.Log(string(data))
Expand Down

0 comments on commit 7964596

Please sign in to comment.