Blame view

test/client_test.go 398 Bytes
7f269318   zhangqijia   add pb.go; 添加关闭连接...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  package main
  
  import (
  	"testing"
  )
  
  type Error struct {
  	errCode uint8
  }
  func (e *Error) Error() string {
  	switch e.errCode {
  	case 1:
  		return "file not found"
  	case 2:
  		return "time out"
  	case 3:
  		return "permission denied"
  	default:
  		return "unknown error"
  	}
  }
  
  func checkError(err error) {
  	if err != nil {
  		panic(err)
  	}
  }
  
  func TestStart( t *testing.T)  {
  	var e *Error
  	checkError(e)
  }