예제 #1
0
func loadCalendar(hackPath, talkPath string) {
	c := make(chan parse.CalEvent)
	go parse.ParseEvent(hackPath, c)
	go parse.ParseEvent(talkPath, c)

	CalEvents.hacknight, CalEvents.talknight = <-c, <-c
}
예제 #2
0
파일: ircbot.go 프로젝트: Ropes/Sheave-Bot
//LoadCalendar reads in the Events from their JSON definitions and
//applies it to global 'events' variable for access
func LoadCalendar() {
	c := make(chan parse.CalEvent)
	go parse.ParseEvent("hacknights.json", c)
	go parse.ParseEvent("talknights.json", c)

	CalEvents.hacknight, CalEvents.talknight = <-c, <-c
}
예제 #3
0
func TestTalkTargetEventParsing(t *testing.T) {
	c := make(chan parse.CalEvent)
	go parse.ParseEvent("testing/resources/talking.json", c)
	jsn := <-c
	//fmt.Printf("%#v\n", jsn)
	if jsn.Location != "ESRI" {
		t.Errorf("Location incorrect: %#v", jsn)
	}
	if jsn.Lat != 45.521525 {
		t.Errorf("Latitude incorrect(45.521525): %#v", jsn)
	}
	if jsn.Localtime != "Tuesday" {
		t.Errorf("Localtime incorrect(Tuesday): %#v", jsn)
	}
}
예제 #4
0
func TestEventResponse(t *testing.T) {
	c := make(chan parse.CalEvent)
	go parse.ParseEvent("testing/resources/talking.json", c)
	jsn := <-c

	out := EventResponse(jsn, "ropes", "Talk Night")
	fmt.Printf("%#v\n", out)
	if len(out) != 3 {
		t.Errorf("Three strings not returned!")
	}
	for i, v := range out {
		if v == "" {
			t.Errorf("String %d empty!: '%s'", i, v)
		}
	}
}