示例#1
0
文件: noun_test.go 项目: gourd/kit
func TestNoun(t *testing.T) {
	sing, plur := "ball", "balls"
	n := httpservice.NewNoun(sing, plur)
	if want, have := sing, n.Singular(); want != have {
		t.Errorf("expected: %#v, got: %#v", want, have)
	}
	if want, have := plur, n.Plural(); want != have {
		t.Errorf("expected: %#v, got: %#v", want, have)
	}
}
示例#2
0
文件: paths_test.go 项目: gourd/kit
func TestPaths(t *testing.T) {
	base, sing, plur := "/some/path", "ball", "balls"
	n := httpservice.NewNoun(sing, plur)
	p := httpservice.NewPaths(base, n, "someid")

	if want, have := "/some/path/ball/someid", p.Singular(); want != have {
		t.Errorf("expected: %#v, got: %#v", want, have)
	}
	if want, have := "/some/path/balls", p.Plural(); want != have {
		t.Errorf("expected: %#v, got: %#v", want, have)
	}

}
示例#3
0
文件: desc_test.go 项目: gourd/kit
func testDesc() httpservice.Desc {
	base, sing, plur := "/some/path", "ball", "balls"
	n := httpservice.NewNoun(sing, plur)
	p := httpservice.NewPaths(base, n, "someid")
	return httpservice.NewDesc(p)
}