MCPcopy Index your code
hub / github.com/tdewolff/canvas / TestPathParseSVGPathErrors

Function TestPathParseSVGPathErrors

path_test.go:780–803  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

778}
779
780func TestPathParseSVGPathErrors(t *testing.T) {
781 var tts = []struct {
782 p string
783 err string
784 }{
785 {"5", "bad path: path should start with command"},
786 {"MM", "bad path: sets of 2 numbers should follow command 'M' at position 2"},
787 {"A10 10 000 20 0", "bad path: largeArc and sweep flags should be 0 or 1 in command 'A' at position 12"},
788 {"A10 10 0 23 20 0", "bad path: largeArc and sweep flags should be 0 or 1 in command 'A' at position 10"},
789
790 // go-fuzz
791 {"V4-z\n0ìGßIzØ", "bad path: unknown command '-' at position 3"},
792 {"ae000e000e00", "bad path: sets of 7 numbers should follow command 'a' at position 2"},
793 {"s........----.......---------------", "bad path: sets of 4 numbers should follow command 's' at position 2"},
794 {"l00000000000000000000+00000000000000000000 00000000000000000000", "bad path: sets of 2 numbers should follow command 'l' at position 64"},
795 }
796 for _, tt := range tts {
797 t.Run(tt.p, func(t *testing.T) {
798 _, err := ParseSVGPath(tt.p)
799 test.That(t, err != nil)
800 test.T(t, err.Error(), tt.err)
801 })
802 }
803}
804
805func TestPathToSVG(t *testing.T) {
806 var tts = []struct {

Callers

nothing calls this directly

Calls 3

ParseSVGPathFunction · 0.85
TMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected