package main import ( "goweb/database" "testing" ) // func TestAdd(t *testing.T) { // if database.CreateTable() != 0 { // t.Errorf("数据库同步失败") // } // } 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("并没有找到") }