nixir/tests/select_or_default.nix
NotAShelf 00a3d2e585
tests: update test cases for newer syntax items; drop old artifacts
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I8640148e8e7597924f9c776750c856266a6a6964
2026-02-22 23:19:42 +03:00

16 lines
384 B
Nix

# Test selection with 'or' default
let
attrs = { a = 1; b = 2; };
in {
# Attribute exists - should use value from attrs
has_attr = attrs.a or 999;
# Attribute doesn't exist - should use default
missing_attr = attrs.c or 100;
# Nested default expression
nested = attrs.d or (attrs.a + attrs.b);
# Default with literal
with_string = attrs.name or "default_name";
}