Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit c837730

Browse files
committed
Add tests for host runner
1 parent f3679ca commit c837730

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

ci/integration/integration_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,28 @@ func TestTCli(t *testing.T) {
9191
)
9292
}
9393

94+
func TestHostRunner(t *testing.T) {
95+
var (
96+
c tcli.HostRunner
97+
ctx = context.Background()
98+
)
99+
100+
c.Run(ctx, "echo testing").Assert(t,
101+
tcli.Success(),
102+
tcli.StderrEmpty(),
103+
tcli.StdoutMatches("testing"),
104+
)
105+
106+
wd, err := os.Getwd()
107+
assert.Success(t, "get working dir", err)
108+
109+
c.Run(ctx, "pwd").Assert(t,
110+
tcli.Success(),
111+
tcli.StderrEmpty(),
112+
tcli.StdoutMatches(wd),
113+
)
114+
}
115+
94116
func TestCoderCLI(t *testing.T) {
95117
ctx := context.Background()
96118

ci/tcli/tcli.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ func (r *HostRunner) Run(ctx context.Context, command string) *Assertable {
114114
if len(parts) > 1 {
115115
args = parts[1:]
116116
}
117+
cmd := exec.CommandContext(ctx, path, args...)
118+
117119
return &Assertable{
118-
cmd: exec.CommandContext(ctx, path, args...),
120+
cmd: cmd,
119121
tname: command,
120122
}
121123
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy