func Test_BucketBuffering(t *testing.T) {
	const RATE = 4 * time.Second
	const CAPACITY = 3
	const ERROR = 500 * time.Millisecond
	b := tokenbucket.NewBucket(RATE, CAPACITY)
	time.Sleep(CAPACITY * RATE)
	before := time.Now()
	<-b.SpendToken(1)
	<-b.SpendToken(1)
	<-b.SpendToken(1)
	after := time.Now()
	if diff := after.Sub(before); diff > RATE {
		t.Errorf("Waited %d seconds, though this should have been nearly instantaneous", diff)
	}
}
Test that a bucket that is full does not block execution
package tokenbucket_test
import (
	"github.com/ChimeraCoder/tokenbucket"
	"testing"
	"time"
)
func Example_BucketUse() {
	bucket := tokenbucket.NewBucket(5*time.Second, 3)
	<-bucket.SpendToken(1)
	RegulatedAction()
}
func RegulatedAction() {
}