@@ -1412,6 +1412,86 @@ func TestFormatToon_Explain(t *testing.T) {
14121412 assert .Contains (t , toon , "Source: schemas" , "toon should render explain output" )
14131413}
14141414
1415+ func TestFormatGCF_Success (t * testing.T ) {
1416+ t .Parallel ()
1417+ g := loadTestGraph (t )
1418+
1419+ result , err := oq .Execute ("schemas | where(isComponent) | take(3) | select name, type" , g )
1420+ require .NoError (t , err )
1421+
1422+ out := oq .FormatGCF (result , g )
1423+ assert .Contains (t , out , "GCF profile=generic" , "gcf should have profile header" )
1424+ assert .Contains (t , out , "{name,type}" , "gcf should declare field names" )
1425+ assert .Contains (t , out , "object" , "gcf should include object type value" )
1426+ }
1427+
1428+ func TestFormatGCF_Count_Success (t * testing.T ) {
1429+ t .Parallel ()
1430+ g := loadTestGraph (t )
1431+
1432+ result , err := oq .Execute ("schemas | length" , g )
1433+ require .NoError (t , err )
1434+
1435+ out := oq .FormatGCF (result , g )
1436+ assert .Contains (t , out , "count=" , "gcf count should use key=value format" )
1437+ }
1438+
1439+ func TestFormatGCF_Groups_Success (t * testing.T ) {
1440+ t .Parallel ()
1441+ g := loadTestGraph (t )
1442+
1443+ result , err := oq .Execute ("schemas | where(isComponent) | group-by(type)" , g )
1444+ require .NoError (t , err )
1445+
1446+ out := oq .FormatGCF (result , g )
1447+ assert .Contains (t , out , "GCF profile=generic" , "gcf should have profile header" )
1448+ assert .Contains (t , out , "{count,key,names}" , "gcf should declare group fields" )
1449+ }
1450+
1451+ func TestFormatGCF_Empty_Success (t * testing.T ) {
1452+ t .Parallel ()
1453+ g := loadTestGraph (t )
1454+
1455+ result , err := oq .Execute (`schemas | where(isComponent) | where(name == "NonExistent")` , g )
1456+ require .NoError (t , err )
1457+
1458+ out := oq .FormatGCF (result , g )
1459+ assert .Contains (t , out , "GCF profile=generic" , "empty gcf should still have profile header" )
1460+ }
1461+
1462+ func TestFormatGCF_SpecialChars (t * testing.T ) {
1463+ t .Parallel ()
1464+ g := loadTestGraph (t )
1465+
1466+ result , err := oq .Execute ("schemas | where(isComponent) | take(1) | select name, depth, isComponent" , g )
1467+ require .NoError (t , err )
1468+
1469+ out := oq .FormatGCF (result , g )
1470+ assert .NotEmpty (t , out , "gcf output should not be empty" )
1471+ assert .Contains (t , out , "GCF profile=generic" , "gcf should have profile header" )
1472+ }
1473+
1474+ func TestFormatGCF_Explain (t * testing.T ) {
1475+ t .Parallel ()
1476+ g := loadTestGraph (t )
1477+
1478+ result , err := oq .Execute ("schemas | where(depth > 0) | explain" , g )
1479+ require .NoError (t , err )
1480+
1481+ out := oq .FormatGCF (result , g )
1482+ assert .Contains (t , out , "Source: schemas" , "gcf should render explain output as-is" )
1483+ }
1484+
1485+ func TestFormatGCF_InlinePipeline (t * testing.T ) {
1486+ t .Parallel ()
1487+ g := loadTestGraph (t )
1488+
1489+ result , err := oq .Execute ("schemas | where(isComponent) | take(3) | format(gcf)" , g )
1490+ require .NoError (t , err )
1491+
1492+ assert .Equal (t , "gcf" , result .FormatHint , "format(gcf) should set FormatHint" )
1493+ }
1494+
14151495func TestFormatMarkdown_Explain (t * testing.T ) {
14161496 t .Parallel ()
14171497 g := loadTestGraph (t )
0 commit comments