brewery
notashelf /
f6481b3c0120ff2f5a3abc60b19cd48bb97581ab

nixir

public

Import-resolving Nix IR plugin

Star0tarball
clone
ssh://git@git.notashelf.dev:33/notashelf/nixir.git
tests/fixtures/select_or_default.nixNix19 lines394 B
1
# Test selection with 'or' default
2
let
3
  attrs = {
4
    a = 1;
5
    b = 2;
6
  };
7
in {
8
  # Attribute exists - should use value from attrs
9
  has_attr = attrs.a or 999;
10
11
  # Attribute doesn't exist - should use default
12
  missing_attr = attrs.c or 100;
13
14
  # Nested default expression
15
  nested = attrs.d or (attrs.a + attrs.b);
16
17
  # Default with literal
18
  with_string = attrs.name or "default_name";
19
}