github.com/therealbill/libredis@v0.0.0-20161227004305-7d50abda5ccf/client/connection_test.go (about)

     1  package client
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestEcho(t *testing.T) {
     8  	msg := "message"
     9  	ret, err := r.Echo(msg)
    10  	if err != nil {
    11  		t.Error(err)
    12  	} else if ret != msg {
    13  		t.Errorf("echo %s\n%s", msg, ret)
    14  	}
    15  }
    16  
    17  func TestPing(t *testing.T) {
    18  	if err := r.Ping(); err != nil {
    19  		t.Error(err)
    20  	}
    21  }
    22  
    23  func BenchmarkPing(b *testing.B) {
    24  	for i := 0; i < b.N; i++ {
    25  		r.Ping()
    26  	}
    27  }