mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-20 20:34:19 +00:00
- Add badges (License, Go version, Release) - Add ASCII flow diagram showing architecture - Add Table of Contents for navigation - Add "Why skillshare?" comparison table - Add Use Cases section (Individual, Team, Open Source) - Add FAQ section with common questions - Add Contributing guide with development setup - Reorganize sections for better readability
54 lines
1.2 KiB
Go
54 lines
1.2 KiB
Go
package utils
|
|
|
|
import "testing"
|
|
|
|
func TestIsHidden(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
input string
|
|
expected bool
|
|
}{
|
|
{"empty string", "", false},
|
|
{"hidden file", ".hidden", true},
|
|
{"hidden directory", ".git", true},
|
|
{"normal file", "file.txt", false},
|
|
{"normal directory", "src", false},
|
|
{"dot only", ".", true},
|
|
{"double dot", "..", true},
|
|
{"file starting with number", "1file", false},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got := IsHidden(tt.input)
|
|
if got != tt.expected {
|
|
t.Errorf("IsHidden(%q) = %v, want %v", tt.input, got, tt.expected)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestHasTildePrefix(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
input string
|
|
expected bool
|
|
}{
|
|
{"empty string", "", false},
|
|
{"tilde path", "~/Documents", true},
|
|
{"tilde only", "~", true},
|
|
{"absolute path", "/home/user", false},
|
|
{"relative path", "./config", false},
|
|
{"tilde in middle", "/home/~user", false},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got := HasTildePrefix(tt.input)
|
|
if got != tt.expected {
|
|
t.Errorf("HasTildePrefix(%q) = %v, want %v", tt.input, got, tt.expected)
|
|
}
|
|
})
|
|
}
|
|
}
|