Home / Function/ Test_ParseParamSquareBrackets() — fiber Function Reference

Test_ParseParamSquareBrackets() — fiber Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

binder/mapping_test.go lines 76–144

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

	tests := []struct {
		err      error
		input    string
		expected string
	}{
		{
			err:      nil,
			input:    "foo[bar]",
			expected: "foo.bar",
		},
		{
			err:      nil,
			input:    "foo[bar][baz]",
			expected: "foo.bar.baz",
		},
		{
			err:      ErrUnmatchedBrackets,
			input:    "foo[bar",
			expected: "",
		},
		{
			err:      ErrUnmatchedBrackets,
			input:    "foo[bar][baz",
			expected: "",
		},
		{
			err:      ErrUnmatchedBrackets,
			input:    "foo]bar[",
			expected: "",
		},
		{
			err:      nil,
			input:    "foo[bar[baz]]",
			expected: "foo.bar.baz",
		},
		{
			err:      nil,
			input:    "",
			expected: "",
		},
		{
			err:      nil,
			input:    "[]",
			expected: "",
		},
		{
			err:      nil,
			input:    "foo[]",
			expected: "foo",
		},
	}

	for _, tt := range tests {
		t.Run(tt.input, func(t *testing.T) {
			t.Parallel()

			result, err := parseParamSquareBrackets(tt.input)
			if tt.err != nil {
				require.ErrorIs(t, err, tt.err)
			} else {
				require.NoError(t, err)
				require.Equal(t, tt.expected, result)
			}
		})
	}
}

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free