Initial release: Go Jdenticon library v0.1.0
- Core library with SVG and PNG generation - CLI tool with generate and batch commands - Cross-platform path handling for Windows compatibility - Comprehensive test suite with integration tests
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package jdenticon
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -17,9 +19,9 @@ func TestJavaScriptReferenceCompatibility(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.input+"_"+string(rune(tc.size)), func(t *testing.T) {
|
||||
// Generate Go SVG
|
||||
goSvg, err := ToSVG(tc.input, tc.size)
|
||||
t.Run(tc.input+"_"+strconv.Itoa(tc.size), func(t *testing.T) {
|
||||
// Generate Go SVG with context
|
||||
goSvg, err := ToSVG(context.Background(), tc.input, tc.size)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to generate Go SVG: %v", err)
|
||||
}
|
||||
@@ -47,12 +49,13 @@ func TestJavaScriptReferenceCompatibility(t *testing.T) {
|
||||
t.Errorf("SVG output differs from JavaScript reference")
|
||||
t.Logf("Go output:\n%s", goSvg)
|
||||
t.Logf("JS reference:\n%s", refSvg)
|
||||
|
||||
|
||||
// Save Go output for manual inspection
|
||||
goPath := filepath.Join("../go-output", refFilename)
|
||||
os.MkdirAll(filepath.Dir(goPath), 0755)
|
||||
os.WriteFile(goPath, []byte(goSvg), 0644)
|
||||
t.Logf("Go output saved to: %s", goPath)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user