Understand Hegel Settings and their hierarchy
mainEvery Hegel run is governed by a Settings value. Settings are applied in a layered hierarchy where each subsequent layer overrides the previous one. The order of precedence (from lowest to highest) is:
- Base Settings: The immutable core values (e.g.,
test_cases = 100,verbosity = "normal"). Accessible via the reservedbaseprofile. - Profiles: Named sets of overrides (e.g.,
ci,development, or custom profiles inhegel.toml). These resolve by walking a chain down tobase. - Compiled-in Settings: Settings defined directly on the test using attribute macros like
#[hegel::test(...)]or#[hegel::main(...)]. - Command-line Flags: For
#[hegel::main]binaries, flags like--seedor--verbosityapply on top of compiled-in settings. - Environment Variables: The final layer. Variables like
HEGEL_TEST_CASESoverride everything else, including settings in the source code.
// Example of compiled-in settings via attribute
#[hegel::test(test_cases = 500, derandomize = true)]
fn compiled_in(tc: TestCase) {
tc.draw(gs::booleans());
}