File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,15 +45,12 @@ func TestFetchUrls(t *testing.T) {
4545}
4646
4747func TestFmtBodyDwnews (t * testing.T ) {
48- raw , _ := gears .HttpGetBody ("https://www.dwnews.com/中国/60179204 " , 10 )
48+ raw , _ := gears .HttpGetBody ("https://www.dwnews.com/全球/60201177 " , 10 )
4949 body , _ := FmtBodyDwnews (raw )
5050 t .Run ("test fetch summary then fmt it: " , func (t * testing.T ) {
51- summary := "> 台湾总统蔡英文正式展开第二任期,美国国务院5月20日表示,批准以1.8亿美元向台湾出售18枚重量级鱼雷。此举料进一步加剧华盛顿与北京已经紧张的关系。"
52- if strings .Contains (body , summary ) {
53- fmt .Println ("Success" )
54- } else {
55- fmt .Println ("Cannot fetch summary correctly." )
51+ summary := "中国与印度军队6月15日再次在边境爆发严重冲突,造成至少20名印军丧生,印度高层官员19日表示,中方指挥官和副指挥官也在这起冲突中丧生。中国未透露中方的伤亡细节。"
52+ if ! strings .Contains (body , summary ) {
53+ t .Errorf ("got:\n %v" , body )
5654 }
57-
5855 })
5956}
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "testing"
5+ )
6+
7+ func TestSaveOneDwnew (t * testing.T ) {
8+ SaveOneDwnew ("https://www.dwnews.com/全球/60201177" )
9+ }
You can’t perform that action at this time.
0 commit comments