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

     1  package client
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestSortList(t *testing.T) {
     8  	r.Del("key")
     9  	r.LPush("key", "one", "two", "three")
    10  	rp, err := r.Sort("key").Limit(0, 2).DESC().Alpha(true).Run()
    11  	if err != nil {
    12  		t.Error(err)
    13  	}
    14  	if result, err := rp.ListValue(); err != nil {
    15  		t.Error(err)
    16  	} else if len(result) != 2 {
    17  		t.Fail()
    18  	} else if result[0] != "two" {
    19  		t.Fail()
    20  	}
    21  }