10 Star 49 Fork 6

Lione / 妹图狩猎者

加入 Gitee
與超過 1200 萬 開發者一起發現、參與優秀開源項目,私有倉庫也完全免費 :)
免費加入
該倉庫未聲明開源許可證文件(LICENSE),使用請關注具體項目描述及其代碼上游依賴。
克隆/下載
task_test.go 727 Bytes
一鍵複製 編輯 原始數據 按行查看 歷史
Lione 提交於 2018-12-17 17:53 . 双层任务捕捉实现
package main
import (
"testing"
)
func TestSingleTask(t *testing.T) {
jsonPath := "./example/单层单任务.json"
RunSingleTask(jsonPath)
}
func TestPreys(t *testing.T) {
var preys []string
var pages []string
pages = []string{
"test_1",
"test_2",
}
chs := make([]chan string, len(pages))
runPrey := func(task_id int, ch chan string, page string) {
ch <- page
}
for task_id, page := range pages {
// preys = append(preys, page)
chs[task_id] = make(chan string, 1)
go runPrey(task_id, chs[task_id], page)
}
for _, ch := range chs {
s := <-ch
preys = append(preys, s)
}
t.Error(preys)
}
func TestDouble(t *testing.T) {
jsonPath := "./example/双层单任务.json"
RunDoubleTask(jsonPath)
}
Go
1
https://gitee.com/Lione/sister_hunter.git
git@gitee.com:Lione/sister_hunter.git
Lione
sister_hunter
妹图狩猎者
master

搜索幫助