浏览代码

Silence StatusNotImplemented error for Logout()

Julien Laffaye 10 年之前
父节点
当前提交
519b366223
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      client_test.go

+ 8 - 1
client_test.go

@@ -3,6 +3,7 @@ package ftp
 import (
 	"bytes"
 	"io/ioutil"
+	"net/textproto"
 	"testing"
 	"time"
 )
@@ -110,7 +111,13 @@ func TestConn(t *testing.T) {
 
 	err = c.Logout()
 	if err != nil {
-		t.Error(err)
+		if protoErr := err.(*textproto.Error); protoErr != nil {
+			if protoErr.Code != StatusNotImplemented {
+				t.Error(err)
+			}
+		} else {
+			t.Error(err)
+		}
 	}
 
 	c.Quit()