fix warnings

This commit is contained in:
Gavin Nishizawa 2023-06-22 13:15:26 -07:00
parent d1e372d896
commit cffac6bfde
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD

View file

@ -4,7 +4,6 @@ import (
"context" "context"
"encoding/xml" "encoding/xml"
"fmt" "fmt"
"io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
@ -228,7 +227,7 @@ func run(t *testing.T, tc testCase) {
err = os.MkdirAll(dataPath, 0755) err = os.MkdirAll(dataPath, 0755)
assert.Success(t, err) assert.Success(t, err)
err = ioutil.WriteFile(pathGotSVG, svgBytes, 0600) err = os.WriteFile(pathGotSVG, svgBytes, 0600)
assert.Success(t, err) assert.Success(t, err)
// Check that it's valid SVG // Check that it's valid SVG
@ -246,16 +245,6 @@ func run(t *testing.T, tc testCase) {
} }
} }
func getShape(t *testing.T, diagram *d2target.Diagram, id string) d2target.Shape {
for _, shape := range diagram.Shapes {
if shape.ID == id {
return shape
}
}
t.Fatalf(`Shape "%s" not found`, id)
return d2target.Shape{}
}
func mdTestScript(md string) string { func mdTestScript(md string) string {
return fmt.Sprintf(` return fmt.Sprintf(`
md: |md md: |md
@ -267,7 +256,7 @@ a -> md -> b
func loadFromFile(t *testing.T, name string) testCase { func loadFromFile(t *testing.T, name string) testCase {
fn := filepath.Join("testdata", "files", fmt.Sprintf("%s.d2", name)) fn := filepath.Join("testdata", "files", fmt.Sprintf("%s.d2", name))
d2Text, err := ioutil.ReadFile(fn) d2Text, err := os.ReadFile(fn)
if err != nil { if err != nil {
t.Fatalf("failed to load test from file:%s. %s", name, err.Error()) t.Fatalf("failed to load test from file:%s. %s", name, err.Error())
} }