Home / Function/ Test_formatBindData_ErrorCases() — fiber Function Reference

Test_formatBindData_ErrorCases() — fiber Function Reference

Architecture documentation for the Test_formatBindData_ErrorCases() function in mapping_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  68323393_a348_83e0_4e27_c26f2f2c4eb6["Test_formatBindData_ErrorCases()"]
  ecb7a598_be7d_ed73_d2c3_8ca5f67838de["mapping_test.go"]
  68323393_a348_83e0_4e27_c26f2f2c4eb6 -->|defined in| ecb7a598_be7d_ed73_d2c3_8ca5f67838de
  style 68323393_a348_83e0_4e27_c26f2f2c4eb6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

binder/mapping_test.go lines 355–397

func Test_formatBindData_ErrorCases(t *testing.T) {
	t.Parallel()

	t.Run("unsupported value type int", func(t *testing.T) {
		t.Parallel()

		out := struct{}{}
		data := make(map[string][]string)
		err := formatBindData("query", out, data, "age", 30, false, false) // int is unsupported
		require.Error(t, err)
		require.EqualError(t, err, "unsupported value type: int")
	})

	t.Run("unsupported value type map", func(t *testing.T) {
		t.Parallel()

		out := struct{}{}
		data := make(map[string][]string)
		err := formatBindData("query", out, data, "map", map[string]string{"key": "value"}, false, false) // map is unsupported
		require.Error(t, err)
		require.EqualError(t, err, "unsupported value type: map[string]string")
	})

	t.Run("bracket notation parsing error", func(t *testing.T) {
		t.Parallel()

		out := struct{}{}
		data := make(map[string][]string)
		err := formatBindData("query", out, data, "invalid[", "value", false, true) // malformed bracket notation
		require.Error(t, err)
		require.EqualError(t, err, "unmatched brackets")
	})

	t.Run("type casting error for []string", func(t *testing.T) {
		t.Parallel()

		out := struct{}{}
		data := make(map[string][]string)
		err := formatBindData("query", out, data, "names", 123, false, false) // invalid type for []string
		require.Error(t, err)
		require.EqualError(t, err, "unsupported value type: int")
	})
}

Domain

Subdomains

Frequently Asked Questions

What does Test_formatBindData_ErrorCases() do?
Test_formatBindData_ErrorCases() is a function in the fiber codebase, defined in binder/mapping_test.go.
Where is Test_formatBindData_ErrorCases() defined?
Test_formatBindData_ErrorCases() is defined in binder/mapping_test.go at line 355.

Analyze Your Own Codebase

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

Try Supermodel Free