Home / Function/ TestRemoveRepeatedChar() — gin Function Reference

TestRemoveRepeatedChar() — gin Function Reference

Architecture documentation for the TestRemoveRepeatedChar() function in path_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  c1d40e6a_67b7_2a5f_3080_05ff237d47ea["TestRemoveRepeatedChar()"]
  b533967c_d510_b36e_3d17_b3b896fbdfe2["path_test.go"]
  c1d40e6a_67b7_2a5f_3080_05ff237d47ea -->|defined in| b533967c_d510_b36e_3d17_b3b896fbdfe2
  style c1d40e6a_67b7_2a5f_3080_05ff237d47ea fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

path_test.go lines 147–192

func TestRemoveRepeatedChar(t *testing.T) {
	testCases := []struct {
		name string
		str  string
		char byte
		want string
	}{
		{
			name: "empty",
			str:  "",
			char: 'a',
			want: "",
		},
		{
			name: "noSlash",
			str:  "abc",
			char: ',',
			want: "abc",
		},
		{
			name: "withSlash",
			str:  "/a/b/c/",
			char: '/',
			want: "/a/b/c/",
		},
		{
			name: "withRepeatedSlashes",
			str:  "/a//b///c////",
			char: '/',
			want: "/a/b/c/",
		},
		{
			name: "threeSlashes",
			str:  "///",
			char: '/',
			want: "/",
		},
	}

	for _, tc := range testCases {
		t.Run(tc.name, func(t *testing.T) {
			res := removeRepeatedChar(tc.str, tc.char)
			assert.Equal(t, tc.want, res)
		})
	}
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does TestRemoveRepeatedChar() do?
TestRemoveRepeatedChar() is a function in the gin codebase, defined in path_test.go.
Where is TestRemoveRepeatedChar() defined?
TestRemoveRepeatedChar() is defined in path_test.go at line 147.

Analyze Your Own Codebase

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

Try Supermodel Free