1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-29 01:12:24 +08:00

fix legacy tests

* remove test for removed feature
* fix `TestNewCommand` test.

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
This commit is contained in:
Steven Allen
2018-01-10 16:08:56 -08:00
committed by Jeromy
parent bf804cca66
commit 2e2996223f

View File

@ -68,7 +68,7 @@ func TestNewCommand(t *testing.T) {
buf := bytes.NewBuffer(nil)
// test calling "test" command
testCmd := root.Subcommand("test")
testCmd := root.Subcommands["test"]
enc := testCmd.Encoders[oldcmds.Text]
if enc == nil {
t.Fatal("got nil encoder")
@ -91,7 +91,7 @@ func TestNewCommand(t *testing.T) {
}
// test getting subcommand
subCmd := testCmd.Subcommand("sub")
subCmd := testCmd.Subcommands["sub"]
if subCmd == nil {
t.Fatal("got nil subcommand")
}
@ -155,32 +155,3 @@ func TestPipePair(t *testing.T) {
<-wait
}
func TestTeeEmitter(t *testing.T) {
req, err := cmds.NewRequest(nil, nil, nil, nil, nil, nil)
if err != nil {
t.Fatal(err)
}
buf1 := bytes.NewBuffer(nil)
re1 := cmds.NewWriterResponseEmitter(WriteNopCloser{buf1}, req, cmds.Encoders[cmds.Text])
buf2 := bytes.NewBuffer(nil)
re2 := cmds.NewWriterResponseEmitter(WriteNopCloser{buf2}, req, cmds.Encoders[cmds.Text])
re := cmds.NewTeeEmitter(re1, re2)
expect := "def"
err = re.Emit(expect)
if err != nil {
t.Fatal(err)
}
if buf1.String() != expect {
t.Fatal("expected %#v, got %#v", expect, buf1.String())
}
if buf2.String() != expect {
t.Fatal("expected %#v, got %#v", expect, buf2.String())
}
}