1package piechart23import (4 "strings"5 "testing"6)78func TestRender(t *testing.T) {9 title := "Test"10 slices := []PieSlice{11 {Value: 10, Color: "#00FF00", Label: "Green"},12 {Value: 20, Color: "#FFFF00", Label: "Yellow"},13 {Value: 30, Color: "#FF0000", Label: "Red"},14 }1516 result := Render(slices, title)1718 // Check if the result contains the expected image SVG structure19 if !strings.Contains(result, "data:image/svg+xml;base64,") {20 t.Errorf("Expected result to contain data:image/svg+xml;base64, got %s", result)21 }2223 // Check if the result contains the title24 if !strings.Contains(result, title) {25 t.Errorf("SVG does not contain the title %q", title)26 }2728 // Check if the result contains non-empty slices29 emptySlices := []PieSlice{}30 emptyResult := Render(emptySlices, title)31 expectedErr := "\npiechart fails: no data provided"32 if emptyResult != expectedErr {33 t.Errorf("Expected exact error for empty slices: %q, got %q", expectedErr, emptyResult)34 }35}36Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.