build: 为项目创建单元测试框架 #45

Manually merged
remilia merged 8 commits from build/test into master 2025-10-27 14:16:26 +08:00
6 changed files with 457 additions and 17 deletions
Showing only changes of commit 75d4d40d39 - Show all commits

View File

@ -11,7 +11,9 @@ export function formatFileSize(sizeInBytes: number): string {
}
export function getFileExtension(filename: string): string {
return filename.split('.').pop() || '';
const lastDotIndex = filename.lastIndexOf('.');
if (lastDotIndex === -1) return ''; // 找不到拓展名
return filename.slice(lastDotIndex + 1);
}
export function formatFileExtension(ext: string): string {