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.

49 lines
867 B

package util
import (
"fmt"
"strings"
"testing"
)
/*
*
@author: sre
@date: 2022/8/21 0021
@desc: todo
*
*/
func TestCheckImageFile(t *testing.T) {
path := "D:\\Desktop\\icon\\m_487c6a80-458c-11eb-a0b7-0016a.jpg"
_, err := CheckImageFile(path)
if err != nil {
fmt.Println(err)
return
}
fmt.Println("success")
}
func TestCheckImageFil2e(t *testing.T) {
path := "D:\\Desktop\\icon\\avatar.png"
_, err := CheckImageFile(path)
if err != nil {
fmt.Println(err)
return
}
fmt.Println("success")
}
func TestIndex2(t *testing.T) {
path := "343455.sdsdsdsd.jpg"
lastIndex := strings.LastIndex(path, ".")
extend := path[lastIndex+1:]
fmt.Println(extend)
}
func TestIndex(t *testing.T) {
path := "D:\\Desktop\\icon\\m_487c6a80-458c-11eb-a0b7-0016a.jpg"
lastIndex := strings.LastIndex(path, ".")
extend := path[lastIndex+1:]
fmt.Println(extend)
}