MCPcopy
hub / github.com/revel/revel / TestBenchmarkRender

Function TestBenchmarkRender

results_test.go:27–39  ·  view source on GitHub ↗

Test that the render response is as expected.

(t *testing.T)

Source from the content-addressed store, hash-verified

25
26// Test that the render response is as expected.
27func TestBenchmarkRender(t *testing.T) {
28 startFakeBookingApp()
29 resp := httptest.NewRecorder()
30 c := NewTestController(resp, showRequest)
31 if err := c.SetAction("Hotels", "Show"); err != nil {
32 t.Errorf("SetAction failed: %s", err)
33 }
34 result := Hotels{c}.Show(3)
35 result.Apply(c.Request, c.Response)
36 if !strings.Contains(resp.Body.String(), "300 Main St.") {
37 t.Errorf("Failed to find hotel address in action response:\n%s", resp.Body)
38 }
39}
40
41func BenchmarkRenderChunked(b *testing.B) {
42 startFakeBookingApp()

Callers

nothing calls this directly

Calls 7

startFakeBookingAppFunction · 0.85
NewTestControllerFunction · 0.85
SetActionMethod · 0.80
ShowMethod · 0.80
ErrorfMethod · 0.65
ApplyMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected