Home / Function/ Test_unquoteCacheDirective() — fiber Function Reference

Test_unquoteCacheDirective() — fiber Function Reference

Architecture documentation for the Test_unquoteCacheDirective() function in cache_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  e1131bef_52af_6df9_37f2_07b8f44fe3d7["Test_unquoteCacheDirective()"]
  8453a087_9678_fe96_1b20_2d125b6f8656["cache_test.go"]
  e1131bef_52af_6df9_37f2_07b8f44fe3d7 -->|defined in| 8453a087_9678_fe96_1b20_2d125b6f8656
  style e1131bef_52af_6df9_37f2_07b8f44fe3d7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/cache/cache_test.go lines 3743–3800

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

	tests := []struct {
		name     string
		input    []byte
		expected []byte
	}{
		{
			name:     "simple quoted string",
			input:    []byte(`"value"`),
			expected: []byte("value"),
		},
		{
			name:     "empty quoted string",
			input:    []byte(`""`),
			expected: []byte(""),
		},
		{
			name:     "quoted string with spaces",
			input:    []byte(`"value with spaces"`),
			expected: []byte("value with spaces"),
		},
		{
			name:     "quoted string with escaped quote",
			input:    []byte(`"value with \"quote\""`),
			expected: []byte(`value with "quote"`),
		},
		{
			name:     "quoted string with escaped backslash",
			input:    []byte(`"value with \\ backslash"`),
			expected: []byte(`value with \ backslash`),
		},
		{
			name:     "quoted string with multiple escapes",
			input:    []byte(`"a\"b\\c\"d"`),
			expected: []byte(`a"b\c"d`),
		},
		{
			name:     "too short input",
			input:    []byte(`"`),
			expected: []byte(`"`),
		},
		{
			name:     "empty input",
			input:    []byte(``),
			expected: []byte(``),
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			t.Parallel()
			result := unquoteCacheDirective(tt.input)
			require.Equal(t, tt.expected, result)
		})
	}
}

Subdomains

Frequently Asked Questions

What does Test_unquoteCacheDirective() do?
Test_unquoteCacheDirective() is a function in the fiber codebase, defined in middleware/cache/cache_test.go.
Where is Test_unquoteCacheDirective() defined?
Test_unquoteCacheDirective() is defined in middleware/cache/cache_test.go at line 3743.

Analyze Your Own Codebase

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

Try Supermodel Free