@@ -23,7 +23,8 @@ func TestCreateToolFromCmd(t *testing.T) {
2323 // Add some flags
2424 cmd .Flags ().String ("output" , "" , "Output file" )
2525 cmd .Flags ().Bool ("verbose" , false , "Verbose output" )
26- cmd .Flags ().StringSlice ("include" , []string {}, "Include patterns" )
26+ cmd .Flags ().IntSlice ("include" , []int {}, "Include patterns" )
27+ cmd .Flags ().StringSlice ("greeting" , []string {"hello" , "world" }, "Include patterns" )
2728 cmd .Flags ().Int ("count" , 10 , "Number of items" )
2829
2930 // Add a hidden flag
@@ -73,6 +74,7 @@ func TestCreateToolFromCmd(t *testing.T) {
7374 assert .Contains (t , flagsSchema .Properties , "verbose" )
7475 assert .Contains (t , flagsSchema .Properties , "include" )
7576 assert .Contains (t , flagsSchema .Properties , "count" )
77+ assert .Contains (t , flagsSchema .Properties , "greeting" )
7678
7779 // Verify excluded flags
7880 assert .NotContains (t , flagsSchema .Properties , "hidden" , "Should not include hidden flag" )
@@ -83,15 +85,30 @@ func TestCreateToolFromCmd(t *testing.T) {
8385 assert .Equal (t , "boolean" , flagsSchema .Properties ["verbose" ].Type )
8486 assert .Equal (t , "array" , flagsSchema .Properties ["include" ].Type )
8587 assert .Equal (t , "integer" , flagsSchema .Properties ["count" ].Type )
88+ assert .Equal (t , "array" , flagsSchema .Properties ["greeting" ].Type )
8689
8790 // Verify required flags
8891 require .Len (t , flagsSchema .Required , 1 , "Should have 1 required flag" )
8992 assert .Contains (t , flagsSchema .Required , "count" , "count flag should be marked as required" )
9093
94+ // Verify default values
95+ assert .NotNil (t , flagsSchema .Properties ["verbose" ].Default )
96+ assert .JSONEq (t , "false" , string (flagsSchema .Properties ["verbose" ].Default ))
97+ assert .NotNil (t , flagsSchema .Properties ["count" ].Default )
98+ assert .JSONEq (t , "10" , string (flagsSchema .Properties ["count" ].Default ))
99+ assert .NotNil (t , flagsSchema .Properties ["greeting" ].Default )
100+ assert .JSONEq (t , `["hello","world"]` , string (flagsSchema .Properties ["greeting" ].Default ))
101+ // Empty string and empty array should not have defaults set
102+ assert .Nil (t , flagsSchema .Properties ["output" ].Default )
103+ assert .Nil (t , flagsSchema .Properties ["include" ].Default )
104+
91105 // Verify array items schema
92106 includeSchema := flagsSchema .Properties ["include" ]
93107 assert .NotNil (t , includeSchema .Items )
94- assert .Equal (t , "string" , includeSchema .Items .Type )
108+ assert .Equal (t , "integer" , includeSchema .Items .Type )
109+ greetingSchema := flagsSchema .Properties ["greeting" ]
110+ assert .NotNil (t , greetingSchema .Items )
111+ assert .Equal (t , "string" , greetingSchema .Items .Type )
95112
96113 // Verify persistent flag from parent command
97114 assert .Contains (t , flagsSchema .Properties , "config" , "Should include persistent flag from parent command" )
0 commit comments