Yasuhiro Matsumoto 8 年之前
父節點
當前提交
f96a447011
共有 1 個文件被更改,包括 15 次插入0 次删除
  1. 15 0
      colorable_test.go

+ 15 - 0
colorable_test.go

@@ -48,6 +48,21 @@ func TestNonColorable(t *testing.T) {
 	}
 }
 
+func TestNonColorableNil(t *testing.T) {
+	paniced := false
+	func() {
+		defer func() {
+			recover()
+			paniced = true
+		}()
+		NewNonColorable(nil)
+	}()
+
+	if !paniced {
+		t.Fatalf("should panic")
+	}
+}
+
 func TestColorable(t *testing.T) {
 	if runtime.GOOS == "windows" {
 		t.Skipf("skip this test on windows")