func (t *tgdzWindow) giveResult() { year, _ := strconv.Atoi(t.inputYear.Text()) if tgdz.CalTGDZ(year) == "" { t.outputResult.SetText("sb 不要乱写") } else { result := t.inputYear.Text() + " 是 " + tgdz.CalTGDZ(year) + " 年" t.outputResult.SetText(result) } }
func TestCalTGDZ(t *testing.T) { year := 2010 //fmt.Scanf("%d", &year) yearN := tgdz.CalTGDZ(year) if yearN == "" { t.Errorf("Error year [%d]\n", yearN) return } fmt.Printf("%d 是 %s 年!", year, yearN) }