File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 145145 expected = [ ./tree/modules/hello-option/mod.nix ] ;
146146 } ;
147147
148+ addAPI . "test API extensions are late bound" = {
149+ expr =
150+ let
151+ first = lit . addAPI { res = self : self . late ; } ;
152+ extended = first . addAPI { late = _self : "hello" ; } ;
153+ in
154+ extended . res ;
155+ expected = "hello" ;
156+ } ;
157+
148158 pipeTo . "test pipes list into a function" = {
149159 expr = ( lit . map lib . pathType ) . pipeTo ( lib . length ) ./tree/x ;
150160 expected = 1 ;
Original file line number Diff line number Diff line change 8888 self : f :
8989 let
9090 __config = ( f self ) ;
91+ boundAPI = builtins . mapAttrs ( _ : g : g ( self f ) ) __config . api ;
9192 in
92- __config . api
93+ boundAPI
9394 // {
9495 inherit __config ;
9596 __functor = functor ;
101102 matchNot = regex : self ( c : mapAttr ( f c ) "filterf" ( andNot ( matchesRegex regex ) ) ) ;
102103 map = mapf : self ( c : mapAttr ( f c ) "mapf" ( compose mapf ) ) ;
103104 addPath = path : self ( c : mapAttr ( f c ) "paths" ( p : p ++ [ path ] ) ) ;
104- addAPI = api : self ( c : mapAttr ( f c ) "api" ( a : a // builtins . mapAttrs ( _ : g : g ( self f ) ) api ) ) ;
105+ addAPI = api : self ( c : mapAttr ( f c ) "api" ( a : a // api ) ) ;
105106
106107 # Configuration updates (non-accumulating)
107108 withLib = lib : self ( c : ( f c ) // { inherit lib ; } ) ;
You can’t perform that action at this time.
0 commit comments