Home / Function/ TestValidateAndModifyStruct() — gin Function Reference

TestValidateAndModifyStruct() — gin Function Reference

Architecture documentation for the TestValidateAndModifyStruct() function in validate_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  1b3eaf4a_9176_150d_8044_3dba5e66113f["TestValidateAndModifyStruct()"]
  7e10d9ab_ee22_270a_45bf_aa404c229204["validate_test.go"]
  1b3eaf4a_9176_150d_8044_3dba5e66113f -->|defined in| 7e10d9ab_ee22_270a_45bf_aa404c229204
  style 1b3eaf4a_9176_150d_8044_3dba5e66113f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

binding/validate_test.go lines 205–218

func TestValidateAndModifyStruct(t *testing.T) {
	// This validates that pointers to structs are passed to the validator
	// giving us the ability to modify the struct being validated.
	engine, ok := Validator.Engine().(*validator.Validate)
	assert.True(t, ok)

	engine.RegisterStructValidation(toZero, structModifyValidation{})

	s := structModifyValidation{Integer: 1}
	errs := validate(&s)

	require.NoError(t, errs)
	assert.Equal(t, structModifyValidation{Integer: 0}, s)
}

Subdomains

Frequently Asked Questions

What does TestValidateAndModifyStruct() do?
TestValidateAndModifyStruct() is a function in the gin codebase, defined in binding/validate_test.go.
Where is TestValidateAndModifyStruct() defined?
TestValidateAndModifyStruct() is defined in binding/validate_test.go at line 205.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free