@@ -27,7 +27,9 @@ final class ToolTests: XCTestCase {
27
27
28
28
func testEncodeTool_googleSearch( ) throws {
29
29
let tool = Tool . googleSearch ( )
30
+
30
31
let jsonData = try encoder. encode ( tool)
32
+
31
33
let jsonString = try XCTUnwrap ( String ( data: jsonData, encoding: . utf8) )
32
34
XCTAssertEqual ( jsonString, """
33
35
{
@@ -38,18 +40,31 @@ final class ToolTests: XCTestCase {
38
40
""" )
39
41
}
40
42
43
+ func testEncodeTool_codeExecution( ) throws {
44
+ let tool = Tool . codeExecution ( )
45
+
46
+ let jsonData = try encoder. encode ( tool)
47
+
48
+ let jsonString = try XCTUnwrap ( String ( data: jsonData, encoding: . utf8) )
49
+ XCTAssertEqual ( jsonString, """
50
+ {
51
+ " codeExecution " : {
52
+
53
+ }
54
+ }
55
+ """ )
56
+ }
57
+
41
58
func testEncodeTool_functionDeclarations( ) throws {
42
59
let functionDecl = FunctionDeclaration (
43
60
name: " test_function " ,
44
61
description: " A test function. " ,
45
62
parameters: [ " param1 " : . string( ) ]
46
63
)
47
64
let tool = Tool . functionDeclarations ( [ functionDecl] )
48
-
49
- encoder. outputFormatting. insert ( . withoutEscapingSlashes)
50
65
let jsonData = try encoder. encode ( tool)
51
- let jsonString = try XCTUnwrap ( String ( data: jsonData, encoding: . utf8) )
52
66
67
+ let jsonString = try XCTUnwrap ( String ( data: jsonData, encoding: . utf8) )
53
68
XCTAssertEqual ( jsonString, """
54
69
{
55
70
" functionDeclarations " : [
0 commit comments