コード例 #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)
}