@@ -40,12 +40,10 @@ final class ActionKitTests: XCTestCase {
4040
4141 /// Test the execution of functions.
4242 func testExecution( ) throws {
43- separator ( )
44- print ( " Function \" Print Text \" " )
43+ separator ( function: " Print Text " )
4544 _ = try printText. run ( input: [ " Hello, world! " ] )
4645
47- separator ( )
48- print ( " Function \" Text \" " )
46+ separator ( function: " Text " )
4947 let simpleCustomFunction = Function (
5048 id: " text " ,
5149 name: " Text " ,
@@ -62,8 +60,7 @@ final class ActionKitTests: XCTestCase {
6260 )
6361 XCTAssertEqual ( try simpleCustomFunction. run ( input: [ " Hello " ] ) as? [ String ] ?? [ ] , [ " Hello " , " Hello " ] )
6462
65- separator ( )
66- print ( " Function \" Add \" " )
63+ separator ( function: " Add " )
6764 let addCustomFunction = Function (
6865 id: " custom-add " ,
6966 name: " Add " ,
@@ -79,11 +76,29 @@ final class ActionKitTests: XCTestCase {
7976 functions: [ . init( " " , icon: . init( " " ) ) { add } ]
8077 )
8178 XCTAssertEqual ( try addCustomFunction. run ( input: [ 1.0 , 2.0 ] ) as? [ Double ] ?? [ ] , [ 3.0 ] )
79+
80+ separator ( function: " Custom in Custom " )
81+ let customInCustomFunction = Function (
82+ id: " custom-in-custom " ,
83+ name: " Custom in Custom " ,
84+ description: " Custom in Custom " ,
85+ input: [ . init( " Number 1 " , type: Double . self) , . init( " Number 2 " , type: Double . self) ] ,
86+ output: [ . init( " Number " , type: Double . self) ] ,
87+ nodes: [ . init( function: " custom-add " ) ] ,
88+ wires: [
89+ . init( from: ( 0 , 1 ) , to: ( 1 , 1 ) ) ,
90+ . init( from: ( 0 , 2 ) , to: ( 1 , 2 ) ) ,
91+ . init( from: ( 1 , 1 ) , to: ( 2 , 1 ) )
92+ ] ,
93+ functions: [ . init( " " , icon: . init( " " ) ) { addCustomFunction } ]
94+ )
95+ XCTAssertEqual ( try customInCustomFunction. run ( input: [ 1.0 , 2.0 ] ) as? [ Double ] ?? [ ] , [ 3.0 ] )
8296 }
8397
8498 /// Print a separator.
85- func separator( ) {
99+ func separator( function : String ) {
86100 print ( " ------------------------- " )
101+ print ( " Function \" \( function) \" " )
87102 }
88103
89104}
0 commit comments