예제 #1
0
func TestParse(t *testing.T) {
	Convey("Parse extdown source", t, func() {
		t, err := extdown.Parse(src)

		So(err, ShouldEqual, nil)
		So(t, ShouldNotEqual, nil)

		Convey("Check generated template", func() {
			s, ok := t.Data["s"].(string)

			So(ok, ShouldEqual, true)
			So(s, ShouldEqual, "string")

			arr, ok := t.Data["arr"].([]interface{})

			So(ok, ShouldEqual, true)
			So(len(arr), ShouldEqual, 2)
			So(arr[0], ShouldEqual, "item1")
			So(arr[1], ShouldEqual, "item2")
		})
	})
}
예제 #2
0
func BenchmarkParse(b *testing.B) {
	for i := 0; i < b.N; i++ {
		extdown.Parse(src)
	}
}