package qrcode import ( "bytes" "os" "testing" "github.com/ajstarks/svgo" "github.com/boombuler/barcode/qr" ) func Test_goqrsvg(t *testing.T) { buf := bytes.NewBufferString("") s := svg.New(buf) // Create the barcode qrCode, _ := qr.Encode("Hello World", qr.M, qr.Auto) // Write QR code to SVG qs := NewQrSVG(qrCode, 5) qs.StartQrSVG(s) qs.WriteQrSVG(s) s.End() // Check if output the same as correctOutput if buf.String() != correctOutput { t.Error("Something is not right... The SVG created is not the same as correctOutput.") } } func ExampleNewQrSVG() { s := svg.New(os.Stdout) // Create the barcode qrCode, _ := qr.Encode("Hello World", qr.M, qr.Auto) // Write QR code to SVG qs := NewQrSVG(qrCode, 5) qs.StartQrSVG(s) qs.WriteQrSVG(s) s.End() } const correctOutput = ` `