Home / Function/ Test_App_GetBytes() — fiber Function Reference

Test_App_GetBytes() — fiber Function Reference

Architecture documentation for the Test_App_GetBytes() function in app_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  6eb74766_876f_6a1d_3388_c774843c7890["Test_App_GetBytes()"]
  e728fdd2_242f_706b_c1d2_041b3d6badb5["app_test.go"]
  6eb74766_876f_6a1d_3388_c774843c7890 -->|defined in| e728fdd2_242f_706b_c1d2_041b3d6badb5
  style 6eb74766_876f_6a1d_3388_c774843c7890 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

app_test.go lines 1320–1345

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

	b := []byte("fiber")
	appMutable := New()
	same := appMutable.GetBytes(b)
	if unsafe.SliceData(same) != unsafe.SliceData(b) { //nolint:gosec // compare pointer addresses
		t.Error("expected original slice when immutable is disabled")
	}

	alias := make([]byte, 10)
	copy(alias, b)
	sub := alias[:5]
	appImmutable := New(Config{Immutable: true})
	copied := appImmutable.GetBytes(sub)
	if unsafe.SliceData(copied) == unsafe.SliceData(sub) { //nolint:gosec // compare pointer addresses
		t.Error("expected a copy for aliased slice when immutable is enabled")
	}

	full := make([]byte, 5)
	copy(full, b)
	detached := appImmutable.GetBytes(full)
	if unsafe.SliceData(detached) == unsafe.SliceData(full) { //nolint:gosec // compare pointer addresses
		t.Error("expected a copy even when cap==len")
	}
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does Test_App_GetBytes() do?
Test_App_GetBytes() is a function in the fiber codebase, defined in app_test.go.
Where is Test_App_GetBytes() defined?
Test_App_GetBytes() is defined in app_test.go at line 1320.

Analyze Your Own Codebase

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

Try Supermodel Free