Beispiel #1
0
func TestSuiteGetters(t *testing.T) {
	suite := new(SuiteTester)
	suite.SetT(t)
	assert.NotNil(t, suite.Assert())
	assert.Equal(t, suite.Assertions, suite.Assert())
	assert.NotNil(t, suite.Require())
	assert.Equal(t, suite.require, suite.Require())
}
Beispiel #2
0
func assertFilter(t *testing.T, filter, field, op, val string) {
	arr, err := _parseSearchQuery(filter)
	assert.NoError(t, err)
	assert.NotNil(t, arr)
	assert.Len(t, arr, 1)
	assert.Equal(t, arr[0], &ep.FilterData{field, op, val})
}
Beispiel #3
0
func TestAddRoute(t *testing.T) {
	router := New()
	router.addRoute("GET", "/", HandlersChain{func(_ *Context) {}})

	assert.Len(t, router.trees, 1)
	assert.NotNil(t, router.trees.get("GET"))
	assert.Nil(t, router.trees.get("POST"))

	router.addRoute("POST", "/", HandlersChain{func(_ *Context) {}})

	assert.Len(t, router.trees, 2)
	assert.NotNil(t, router.trees.get("GET"))
	assert.NotNil(t, router.trees.get("POST"))

	router.addRoute("POST", "/post", HandlersChain{func(_ *Context) {}})
	assert.Len(t, router.trees, 2)
}
Beispiel #4
0
func assertRangeFilter(t *testing.T, min, max, res0, res1 string) {
	arr, err := _parseSearchQuery("test:" + min + ".." + max)
	assert.NoError(t, err)
	assert.NotNil(t, arr)
	assert.Len(t, arr, 2)
	assert.Equal(t, arr[0], &ep.FilterData{"test", ">=", res0})
	assert.Equal(t, arr[1], &ep.FilterData{"test", "<=", res1})
}
Beispiel #5
0
// NotNil asserts that the specified object is not nil.
//
//    require.NotNil(t, err, "err should be something")
func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) {
	if !assert.NotNil(t, object, msgAndArgs...) {
		t.FailNow()
	}
}
Beispiel #6
0
func (s *SuiteLoggingTester) TestLoggingFail() {
	s.T().Log("TESTLOGFAIL")
	assert.NotNil(s.T(), nil) // expected to fail
}