Files
liuhaijun 5b9c407a15 解决冲突
Change-Id: I1a6f6f9e1bce6c85115df05d595e5d2b20fb8f08
2025-07-10 11:53:27 +08:00

49 lines
886 B
Go

package utils
import (
"testing"
)
func TestGetRunPath(t *testing.T) {
path := GetRunPath()
if path == "" {
t.Error("获取运行路径失败")
}
}
func TestGetCurrentPath(t *testing.T) {
_, err := GetCurrentPath()
if err != nil {
t.Error("获取运行路径失败")
}
}
func TestGetCurrentAbPathByExecutable(t *testing.T) {
_, err := GetCurrentAbPathByExecutable()
if err != nil {
t.Error("获取路径失败")
}
}
func TestGetCurrentFileDirectory(t *testing.T) {
path, ok := GetFileDirectoryToCaller()
if !ok {
t.Error("获取路径失败", path)
}
path, ok = GetFileDirectoryToCaller(1)
if !ok {
t.Error("获取路径失败", path)
}
}
func TestIf(t *testing.T) {
if 3 != If(false, 1, 3) {
t.Error("模拟三元操作失败")
}
if 1 != If(true, 1, 3) {
t.Error("模拟三元操作失败")
}
}