From f71274b601c07d03f9c28eb1bc012d954a7e2d21 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Wed, 9 Oct 2024 12:34:01 +0200 Subject: [PATCH] Add test to ensure that file icons are one rune This should prevent errors like that from happening again. --- pkg/gui/presentation/icons/file_icons_test.go | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 pkg/gui/presentation/icons/file_icons_test.go diff --git a/pkg/gui/presentation/icons/file_icons_test.go b/pkg/gui/presentation/icons/file_icons_test.go new file mode 100644 index 000000000..030dfb020 --- /dev/null +++ b/pkg/gui/presentation/icons/file_icons_test.go @@ -0,0 +1,21 @@ +package icons + +import ( + "testing" +) + +func TestFileIcons(t *testing.T) { + t.Run("TestFileIcons", func(t *testing.T) { + for name, icon := range nameIconMap { + if len([]rune(icon.Icon)) != 1 { + t.Errorf("nameIconMap[\"%s\"] is not a single rune", name) + } + } + + for ext, icon := range extIconMap { + if len([]rune(icon.Icon)) != 1 { + t.Errorf("extIconMap[\"%s\"] is not a single rune", ext) + } + } + }) +}