layouttest

package
v1.17.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package layouttest is the helper for the layout test that every Go mirror of a C struct needs (SPEC §8.1 rule 3). It imports package testing, so only test files import it: package dl, which every program that loads a C library links, does not.

Flutter: no counterpart.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertLayout

func AssertLayout(t testing.TB, name string, size uintptr, offsets map[string]uintptr, got any)

AssertLayout is a test helper for the layout test that every Go mirror of a C struct needs (SPEC §8.1 rule 3). It checks that the struct value got has the given size and the given field offsets, as taken from the C headers and recorded in the test. Every named field of got must be listed in offsets, so that a field added later cannot escape the test. Fields named "_" are padding and are skipped. It reports every difference with t.Errorf.

Flutter: no counterpart

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL