move utilites to own module

This commit is contained in:
2024-03-23 20:07:56 +01:00
parent 9df81f3e4e
commit ca6771e72a
7 changed files with 123 additions and 6 deletions

View File

@@ -0,0 +1,27 @@
package utilities
import (
"os"
"testing"
)
func TestFileExists(t *testing.T) {
// Create a temporary file for testing
file, err := os.CreateTemp("", "testfile")
if err != nil {
t.Fatalf("Failed to create temporary file: %v", err)
}
defer os.Remove(file.Name())
// Test with an existing file
exists := FileExists(file.Name())
if !exists {
t.Errorf("FileExists(%q) = false, want true", file.Name())
}
// Test with a non-existing file
exists = FileExists("non_existing_file.txt")
if exists {
t.Errorf("FileExists(%q) = true, want false", "non_existing_file.txt")
}
}