예제 #1
0
func utilsFunc(w http.ResponseWriter, r *http.Request) utils.Utils {
	return utils.OtherNew(r)
}
package services

import (
	"reflect"
	"runtime"
	"testing"

	"github.com/daohoangson/go-socialcounters/utils"
)

var u = utils.OtherNew(nil)

func assert(t *testing.T, req request, expectedUrl string, expectedCount int64) {
	expectedResultFound := false

	for url, res := range req.Results {
		if url != expectedUrl {
			continue
		}
		expectedResultFound = true

		if res.Error != nil {
			t.Fatalf("Unexpected `Error` (%s), Response=%s", res.Error, res.Response)
		}

		if res.Count < expectedCount {
			t.Fatalf("Count is too small (%d, should be > %d)", res.Count, expectedCount)
		}

		t.Logf("%s(%s): Count=%d, Response=%s", req.Service, url, res.Count, res.Response)
	}