mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/fs: add test for IsTemporaryFileName
This commit is contained in:
parent
867612a4a4
commit
51263b1a45
1 changed files with 24 additions and 0 deletions
24
lib/fs/fs_test.go
Normal file
24
lib/fs/fs_test.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package fs
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestIsTemporaryFileName(t *testing.T) {
|
||||
f := func(s string, resultExpected bool) {
|
||||
t.Helper()
|
||||
result := IsTemporaryFileName(s)
|
||||
if result != resultExpected {
|
||||
t.Fatalf("unexpected IsTemporaryFileName(%q); got %v; want %v", s, result, resultExpected)
|
||||
}
|
||||
}
|
||||
f("", false)
|
||||
f(".", false)
|
||||
f(".tmp", false)
|
||||
f("tmp.123", false)
|
||||
f(".tmp.123.xx", false)
|
||||
f(".tmp.1", true)
|
||||
f("asdf.dff.tmp.123", true)
|
||||
f("asdf.sdfds.tmp.dfd", false)
|
||||
f("dfd.sdfds.dfds.1232", false)
|
||||
}
|
Loading…
Reference in a new issue