2015-05-10 09:59:42 +00:00
|
|
|
// Copyright (C) 2015 The Syncthing Authors.
|
|
|
|
//
|
|
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
2017-02-09 06:52:18 +00:00
|
|
|
// You can obtain one at https://mozilla.org/MPL/2.0/.
|
2015-05-10 09:59:42 +00:00
|
|
|
|
2017-01-17 07:33:48 +00:00
|
|
|
package ignore
|
2015-05-10 09:59:42 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestLongTempFilename(t *testing.T) {
|
|
|
|
filename := ""
|
|
|
|
for i := 0; i < 300; i++ {
|
|
|
|
filename += "l"
|
|
|
|
}
|
2017-01-17 07:33:48 +00:00
|
|
|
tFile := TempName(filename)
|
2015-05-10 09:59:42 +00:00
|
|
|
if len(tFile) < 10 || len(tFile) > 200 {
|
|
|
|
t.Fatal("Invalid long filename")
|
|
|
|
}
|
2017-01-17 07:33:48 +00:00
|
|
|
if !strings.HasSuffix(TempName("short"), "short.tmp") {
|
|
|
|
t.Fatal("Invalid short filename", TempName("short"))
|
2015-05-10 09:59:42 +00:00
|
|
|
}
|
|
|
|
}
|