@cryptotaxi247 / kubo / commits / 2e2996223

fix legacy tests

* remove test for removed feature * fix `TestNewCommand` test. License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>

Steven Allen committed Jan 10, 2018 at 16:08 UTC 2e2996223f9957c55683e837cfe5e4c7193055d7
1 file changed +2 -31
commands/legacy/legacy_test.go
+2 -31
@@ -68,7 +68,7 @@ func TestNewCommand(t *testing.T) {
68 buf := bytes.NewBuffer(nil)
69
70 // test calling "test" command
71 - testCmd := root.Subcommand("test")
71 + testCmd := root.Subcommands["test"]
72 enc := testCmd.Encoders[oldcmds.Text]
73 if enc == nil {
74 t.Fatal("got nil encoder")
@@ -91,7 +91,7 @@ func TestNewCommand(t *testing.T) {
91 }
92
93 // test getting subcommand
94 - subCmd := testCmd.Subcommand("sub")
94 + subCmd := testCmd.Subcommands["sub"]
95 if subCmd == nil {
96 t.Fatal("got nil subcommand")
97 }
@@ -155,32 +155,3 @@ func TestPipePair(t *testing.T) {
155 <-wait
156
157 }
158 -
159 -func TestTeeEmitter(t *testing.T) {
160 - req, err := cmds.NewRequest(nil, nil, nil, nil, nil, nil)
161 - if err != nil {
162 - t.Fatal(err)
163 - }
164 -
165 - buf1 := bytes.NewBuffer(nil)
166 - re1 := cmds.NewWriterResponseEmitter(WriteNopCloser{buf1}, req, cmds.Encoders[cmds.Text])
167 -
168 - buf2 := bytes.NewBuffer(nil)
169 - re2 := cmds.NewWriterResponseEmitter(WriteNopCloser{buf2}, req, cmds.Encoders[cmds.Text])
170 -
171 - re := cmds.NewTeeEmitter(re1, re2)
172 -
173 - expect := "def"
174 - err = re.Emit(expect)
175 - if err != nil {
176 - t.Fatal(err)
177 - }
178 -
179 - if buf1.String() != expect {
180 - t.Fatal("expected %#v, got %#v", expect, buf1.String())
181 - }
182 -
183 - if buf2.String() != expect {
184 - t.Fatal("expected %#v, got %#v", expect, buf2.String())
185 - }
186 -}