10 Star 61 Fork 5

devfeel / dotweb

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
plugin_test.go 968 Bytes
一键复制 编辑 原始数据 按行查看 历史
thinkdev 提交于 2019-07-22 14:03 . #### Version 1.7.0
package dotweb
import (
"fmt"
"github.com/devfeel/dotweb/test"
"testing"
"time"
)
type testPlugin struct {
}
func (p *testPlugin) Name() string {
return "test"
}
func (p *testPlugin) Run() error {
fmt.Println(p.Name(), "runing")
//panic("error test run")
return nil
}
func (p *testPlugin) IsValidate() bool {
return true
}
func TestNotifyPlugin_Name(t *testing.T) {
app := newConfigDotWeb()
//fmt.Println(app.Config.ConfigFilePath)
p := NewDefaultNotifyPlugin(app)
needShow := "NotifyPlugin"
test.Equal(t, needShow, p.Name())
}
func TestNotifyPlugin_IsValidate(t *testing.T) {
app := newConfigDotWeb()
p := NewDefaultNotifyPlugin(app)
needShow := true
test.Equal(t, needShow, p.IsValidate())
}
func TestNotifyPlugin_Run(t *testing.T) {
app := newConfigDotWeb()
p := NewDefaultNotifyPlugin(app)
go func() {
for {
fmt.Println(p.ModTimes[app.Config.ConfigFilePath])
time.Sleep(time.Duration(600 * time.Millisecond))
}
}()
p.Run()
}
Go
1
https://gitee.com/devfeel/dotweb.git
git@gitee.com:devfeel/dotweb.git
devfeel
dotweb
dotweb
master

搜索帮助