示例#1
0
func TestRegexPath_Error(t *testing.T) {

	pattern := `[0-9]++`
	matcherFunc := RegexPath(pattern)

	var ctx context.Context

	ctx = context_test.MakeTestContextWithPath("adam[23]")
	_, err := matcherFunc(ctx)
	assert.Error(t, err)

}
示例#2
0
文件: map_test.go 项目: MG-RAST/Shock
func TestMapFromBase64StringWithError(t *testing.T) {

	base64String := "eyJuYW1lIjoiTWFasd0In0="

	_, err := FromBase64(base64String)

	assert.Error(t, err)

	assert.Panics(t, func() {
		MustFromBase64(base64String)
	})

}
示例#3
0
文件: map_test.go 项目: MG-RAST/Shock
func TestMapFromSignedBase64StringWithError(t *testing.T) {

	base64String := "eyJuYW1lasdIjoiTWF0In0=_67ee82916f90b2c0d68c903266e8998c9ef0c3d6"

	_, err := FromSignedBase64(base64String, "key")

	assert.Error(t, err)

	assert.Panics(t, func() {
		MustFromSignedBase64(base64String, "key")
	})

}
示例#4
0
func TestConversionSignedBase64WithError(t *testing.T) {

	o := MSI()
	o["test"] = func() {}

	assert.Panics(t, func() {
		o.MustSignedBase64("key")
	})

	_, err := o.SignedBase64("key")

	assert.Error(t, err)

}
示例#5
0
func TestConversionBase64WithError(t *testing.T) {

	o := MSI()
	o["test"] = func() {}

	assert.Panics(t, func() {
		o.MustBase64()
	})

	_, err := o.Base64()

	assert.Error(t, err)

}
示例#6
0
func TestConversionJSONWithError(t *testing.T) {

	o := MSI()
	o["test"] = func() {}

	assert.Panics(t, func() {
		o.MustJSON()
	})

	_, err := o.JSON()

	assert.Error(t, err)

}
示例#7
0
文件: map_test.go 项目: MG-RAST/Shock
func TestMapMustFromJSONWithError(t *testing.T) {

	_, err := FromJSON(`"name":"Mat"}`)
	assert.Error(t, err)

}