初始化项目

This commit is contained in:
2026-01-08 20:48:55 +08:00
commit 0cc737a8dd
66 changed files with 7410 additions and 0 deletions

40
scanner_test.go Normal file
View File

@@ -0,0 +1,40 @@
package main
import (
"testing"
)
func TestIsAudioFile(t *testing.T) {
tests := []struct {
name string
path string
expected bool
}{
{"mp3 file", "song.mp3", true},
{"flac file", "song.flac", true},
{"m4a file", "song.m4a", true},
{"wav file", "song.wav", true},
{"ogg file", "song.ogg", true},
{"aac file", "song.aac", false},
{"wma file", "song.wma", false},
{"uppercase extension", "song.MP3", true},
{"mixed case", "song.Mp3", true},
{"txt file", "song.txt", false},
{"jpg file", "song.jpg", false},
{"no extension", "song", false},
{"dot in name", "my.song.mp3", true},
{"multiple dots", "my.song.final.mp3", true},
{"path with directory", "/path/to/song.mp3", true},
{"Windows path", "C:\\Music\\song.mp3", true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := isAudioFile(tt.path)
if result != tt.expected {
t.Errorf("isAudioFile(%q) = %v, want %v", tt.path, result, tt.expected)
}
})
}
}