提交 216616c3 编写于 作者: D Derek Parker

terminal: misc cleanup

上级 ecc95cd2
...@@ -18,9 +18,7 @@ import ( ...@@ -18,9 +18,7 @@ import (
type FakeTerminal struct { type FakeTerminal struct {
*Term *Term
t testing.TB t testing.TB
client service.Client
cmds *Commands
} }
func (ft *FakeTerminal) Exec(cmdstr string) (outstr string, err error) { func (ft *FakeTerminal) Exec(cmdstr string) (outstr string, err error) {
...@@ -65,7 +63,7 @@ func (ft *FakeTerminal) AssertExec(cmdstr, tgt string) { ...@@ -65,7 +63,7 @@ func (ft *FakeTerminal) AssertExec(cmdstr, tgt string) {
func (ft *FakeTerminal) AssertExecError(cmdstr, tgterr string) { func (ft *FakeTerminal) AssertExecError(cmdstr, tgterr string) {
_, err := ft.Exec(cmdstr) _, err := ft.Exec(cmdstr)
if err == nil { if err == nil {
ft.t.Fatalf("Expected error executing %q") ft.t.Fatalf("Expected error executing %q", cmdstr)
} }
if err.Error() != tgterr { if err.Error() != tgterr {
ft.t.Fatalf("Expected error %q executing %q, got error %q", tgterr, cmdstr, err.Error()) ft.t.Fatalf("Expected error %q executing %q, got error %q", tgterr, cmdstr, err.Error())
...@@ -91,10 +89,8 @@ func withTestTerminal(name string, t testing.TB, fn func(*FakeTerminal)) { ...@@ -91,10 +89,8 @@ func withTestTerminal(name string, t testing.TB, fn func(*FakeTerminal)) {
}() }()
ft := &FakeTerminal{ ft := &FakeTerminal{
t: t, t: t,
client: client, Term: New(client, nil),
cmds: DebugCommands(client),
Term: New(client, nil),
} }
fn(ft) fn(ft)
} }
...@@ -178,9 +174,7 @@ func TestExecuteFile(t *testing.T) { ...@@ -178,9 +174,7 @@ func TestExecuteFile(t *testing.T) {
} }
fixturesDir := test.FindFixturesDir() fixturesDir := test.FindFixturesDir()
err := c.executeFile(nil, filepath.Join(fixturesDir, "bpfile")) err := c.executeFile(nil, filepath.Join(fixturesDir, "bpfile"))
if err != nil { if err != nil {
t.Fatalf("executeFile: %v", err) t.Fatalf("executeFile: %v", err)
} }
...@@ -215,7 +209,6 @@ func TestScopePrefix(t *testing.T) { ...@@ -215,7 +209,6 @@ func TestScopePrefix(t *testing.T) {
term.MustExec("continue") term.MustExec("continue")
goroutinesOut := strings.Split(term.MustExec("goroutines"), "\n") goroutinesOut := strings.Split(term.MustExec("goroutines"), "\n")
agoroutines := []int{} agoroutines := []int{}
curgid := -1 curgid := -1
...@@ -255,8 +248,6 @@ func TestScopePrefix(t *testing.T) { ...@@ -255,8 +248,6 @@ func TestScopePrefix(t *testing.T) {
} }
seen := make([]bool, 10) seen := make([]bool, 10)
_ = seen
for _, gid := range agoroutines { for _, gid := range agoroutines {
stackOut := strings.Split(term.MustExec(fmt.Sprintf("goroutine %d stack", gid)), "\n") stackOut := strings.Split(term.MustExec(fmt.Sprintf("goroutine %d stack", gid)), "\n")
fid := -1 fid := -1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册