mirror of
https://git.sr.ht/~rjarry/aerc
synced 2026-11-01 16:11:05 +01:00
In a few places around the codebase, we had the same pattern of creating a slice of paths pointing to specific resource directories. Let's use a function to encapsulate the logic. Signed-off-by: Tristan Partin <tristan@partin.io> Acked-by: Robin Jarry <robin@jarry.cc>
21 lines
420 B
Go
21 lines
420 B
Go
package config
|
|
|
|
import (
|
|
"path"
|
|
"testing"
|
|
)
|
|
|
|
// Test that the function returns a non-empty slice of strings
|
|
func TestResourceDirs(t *testing.T) {
|
|
dirs := ResourceDirs("test")
|
|
if len(dirs) == 0 {
|
|
t.Errorf("Expected non-empty slice of strings, got %v", dirs)
|
|
}
|
|
|
|
for _, dir := range dirs {
|
|
if path.Base(dir) != "test" {
|
|
t.Errorf("Expected last component of path to be 'test', got %s", path.Base(dir))
|
|
}
|
|
}
|
|
}
|