30 lines
479 B
Go
30 lines
479 B
Go
package main
|
|
|
|
import (
|
|
"mime"
|
|
"testing"
|
|
|
|
"github.com/dustin/go-humanize"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
func Test_Mime(t *testing.T) {
|
|
// Test code here
|
|
m := "application/rar"
|
|
m = "video/mp4"
|
|
|
|
t.Log(mime.ExtensionsByType(m))
|
|
}
|
|
|
|
func Test_Size(t *testing.T) {
|
|
// Test code here
|
|
s := 6456390
|
|
t.Logf("Size: %d", s)
|
|
t.Logf("Human: %s", humanize.Bytes(uint64(s)))
|
|
|
|
viper.Set("size", "20MB")
|
|
b := viper.GetSizeInBytes("size")
|
|
t.Logf("Size: %d", s)
|
|
t.Logf("Vize: %d", b)
|
|
}
|