package display_test import ( "testing" "git.maze.io/go/harmon/display" ) func TestParseSize(t *testing.T) { testCases := []struct { Test string DefaultWidth int DefaultHeight int Width int Height int }{ {"", 128, 64, 128, 64}, {"x32", 128, 64, 128, 32}, {"64x", 128, 64, 64, 64}, {"123x456", 128, 64, 123, 456}, } for _, test := range testCases { t.Run(test.Test, func(it *testing.T) { w, h, err := display.ParseSize(test.Test, test.DefaultWidth, test.DefaultHeight) if err != nil { it.Fatal(err) } if w != test.Width { it.Errorf("expected %q to return width %d, got %d", test.Test, test.Width, w) } if h != test.Height { it.Errorf("expected %q to return height %d, got %d", test.Test, test.Height, h) } }) } }