go_echo_wol/main_test.go

31 lines
514 B
Go
Raw Normal View History

2023-09-04 18:00:09 +08:00
package main
import (
"goweb/database"
2023-09-04 18:00:09 +08:00
"testing"
)
// func TestAdd(t *testing.T) {
// if database.CreateTable() != 0 {
// t.Errorf("数据库同步失败")
// }
// }
2023-09-04 18:00:09 +08:00
func TestAdd_Delwol(t *testing.T) {
wol := new(database.Wol)
wol.Mac = "8F:26:58:C1:85:83"
wol.Name = "text"
database.Insert(wol)
wolarray := make([]database.Wol, 0)
database.Getallwol(&wolarray)
for _, item := range wolarray {
if item.Name == wol.Name {
database.Del(item.ID)
return
}
}
t.Errorf("并没有找到")
2023-09-04 18:00:09 +08:00
}