mirror of https://github.com/go-gitea/gitea
Git with a cup of tea, painless self-hosted git service
Mirror for internal git.with.parts use
https://git.with.parts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
891 B
32 lines
891 B
// Copyright 2025 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package git
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestArchiveType(t *testing.T) {
|
|
name, archiveType := SplitArchiveNameType("test.tar.gz")
|
|
assert.Equal(t, "test", name)
|
|
assert.Equal(t, "tar.gz", archiveType.String())
|
|
|
|
name, archiveType = SplitArchiveNameType("a/b/test.zip")
|
|
assert.Equal(t, "a/b/test", name)
|
|
assert.Equal(t, "zip", archiveType.String())
|
|
|
|
name, archiveType = SplitArchiveNameType("1234.bundle")
|
|
assert.Equal(t, "1234", name)
|
|
assert.Equal(t, "bundle", archiveType.String())
|
|
|
|
name, archiveType = SplitArchiveNameType("test")
|
|
assert.Equal(t, "test", name)
|
|
assert.Equal(t, "unknown", archiveType.String())
|
|
|
|
name, archiveType = SplitArchiveNameType("test.xz")
|
|
assert.Equal(t, "test.xz", name)
|
|
assert.Equal(t, "unknown", archiveType.String())
|
|
}
|
|
|