Skip to content

Commit 0f6050c

Browse files
committed
Converted spaces to tabs in the test files
1 parent 100fc2e commit 0f6050c

9 files changed

+89
-89
lines changed

binder_test.go

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package revel
66

77
import (
8+
"encoding/json"
89
"fmt"
910
"io"
1011
"io/ioutil"
@@ -14,7 +15,6 @@ import (
1415
"strings"
1516
"testing"
1617
"time"
17-
"encoding/json"
1818
)
1919

2020
type A struct {
@@ -165,31 +165,32 @@ var fileBindings = []struct{ val, arrval, f interface{} }{
165165
{(*io.Reader)(nil), []io.Reader{}, ioutil.ReadAll},
166166
{(*io.ReadSeeker)(nil), []io.ReadSeeker{}, ioutil.ReadAll},
167167
}
168+
168169
func TestJsonBinder(t *testing.T) {
169-
// Reuse the mvc_test.go multipart request to test the binder.
170-
foo := struct {
171-
A string
172-
}{}
173-
d,_ := json.Marshal(map[string]string{"a":"b"})
174-
params := &Params{JsonRequest:true,Json:d}
175-
c := NewGOContext(nil)
176-
c.Request.SetRequest(getMultipartRequest())
177-
ParseParams(params, NewRequest(c.Request ))
170+
// Reuse the mvc_test.go multipart request to test the binder.
171+
foo := struct {
172+
A string
173+
}{}
174+
d, _ := json.Marshal(map[string]string{"a": "b"})
175+
params := &Params{JsonRequest: true, Json: d}
176+
c := NewGOContext(nil)
177+
c.Request.SetRequest(getMultipartRequest())
178+
ParseParams(params, NewRequest(c.Request))
178179

179-
actual := Bind(params, "test", reflect.TypeOf(foo))
180-
if actual.Interface().(struct {
181-
A string
182-
}).A!="b" {
183-
t.Fail()
184-
}
180+
actual := Bind(params, "test", reflect.TypeOf(foo))
181+
if actual.Interface().(struct {
182+
A string
183+
}).A != "b" {
184+
t.Fail()
185+
}
185186

186187
}
187188
func TestBinder(t *testing.T) {
188189
// Reuse the mvc_test.go multipart request to test the binder.
189190
params := &Params{}
190-
c := NewGOContext(nil)
191-
c.Request.SetRequest(getMultipartRequest())
192-
ParseParams(params, NewRequest(c.Request ))
191+
c := NewGOContext(nil)
192+
c.Request.SetRequest(getMultipartRequest())
193+
ParseParams(params, NewRequest(c.Request))
193194
params.Values = ParamTestValues
194195

195196
// Values

compress_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import (
1414
func TestBenchmarkCompressed(t *testing.T) {
1515
startFakeBookingApp()
1616
resp := httptest.NewRecorder()
17-
context := NewGOContext(nil)
18-
context.Request.SetRequest(showRequest)
19-
context.Response.SetResponse(resp)
17+
context := NewGOContext(nil)
18+
context.Request.SetRequest(showRequest)
19+
context.Response.SetResponse(resp)
2020
c := NewController(context)
2121
if err := c.SetAction("Hotels", "Show"); err != nil {
2222
t.Errorf("SetAction failed: %s", err)
@@ -33,9 +33,9 @@ func BenchmarkRenderCompressed(b *testing.B) {
3333
startFakeBookingApp()
3434
resp := httptest.NewRecorder()
3535
resp.Body = nil
36-
context := NewGOContext(nil)
37-
context.Request.SetRequest(showRequest)
38-
context.Response.SetResponse(resp)
36+
context := NewGOContext(nil)
37+
context.Request.SetRequest(showRequest)
38+
context.Response.SetResponse(resp)
3939
c := NewController(context)
4040
if err := c.SetAction("Hotels", "Show"); err != nil {
4141
b.Errorf("SetAction failed: %s", err)
@@ -53,9 +53,9 @@ func BenchmarkRenderUnCompressed(b *testing.B) {
5353
startFakeBookingApp()
5454
resp := httptest.NewRecorder()
5555
resp.Body = nil
56-
context := NewGOContext(nil)
57-
context.Request.SetRequest(showRequest)
58-
context.Response.SetResponse(resp)
56+
context := NewGOContext(nil)
57+
context.Request.SetRequest(showRequest)
58+
context.Response.SetResponse(resp)
5959
c := NewController(context)
6060
if err := c.SetAction("Hotels", "Show"); err != nil {
6161
b.Errorf("SetAction failed: %s", err)

fakeapp_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,6 @@ func startFakeBookingApp() {
107107
},
108108
})
109109
InitServerEngine(9000, GO_NATIVE_SERVER_ENGINE)
110-
initControllerStack()
110+
initControllerStack()
111111
runStartupHooks()
112112
}

invoker_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ func BenchmarkSetAction(b *testing.B) {
117117

118118
func BenchmarkInvoker(b *testing.B) {
119119
startFakeBookingApp()
120-
context := NewGOContext(nil)
121-
context.Request.SetRequest(showRequest)
122-
c := NewController(context)
123-
c.ViewArgs = make(map[string]interface{})
120+
context := NewGOContext(nil)
121+
context.Request.SetRequest(showRequest)
122+
c := NewController(context)
123+
c.ViewArgs = make(map[string]interface{})
124124
if err := c.SetAction("Hotels", "Show"); err != nil {
125125
b.Errorf("Failed to set action: %s", err)
126126
return

params_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,21 @@ func getMultipartRequest() *http.Request {
8989
}
9090

9191
func BenchmarkParams(b *testing.B) {
92-
context := NewGOContext(nil)
93-
context.Request.SetRequest(showRequest)
94-
c := NewController(context)
95-
c.Params = &Params{}
92+
context := NewGOContext(nil)
93+
context.Request.SetRequest(showRequest)
94+
c := NewController(context)
95+
c.Params = &Params{}
9696

9797
for i := 0; i < b.N; i++ {
9898
ParamsFilter(c, NilChain)
9999
}
100100
}
101101

102102
func TestMultipartForm(t *testing.T) {
103-
context := NewGOContext(nil)
104-
context.Request.SetRequest(getMultipartRequest())
105-
c := NewController(context)
106-
c.Params = &Params{}
103+
context := NewGOContext(nil)
104+
context.Request.SetRequest(getMultipartRequest())
105+
c := NewController(context)
106+
c.Params = &Params{}
107107

108108
ParamsFilter(c, NilChain)
109109

@@ -180,9 +180,9 @@ func BenchmarkResolveAcceptLanguage(b *testing.B) {
180180
func buildHTTPRequestWithAcceptLanguage(acceptLanguage string) *Request {
181181
request, _ := http.NewRequest("POST", "http://localhost/path", nil)
182182
request.Header.Set("Accept-Language", acceptLanguage)
183-
context := NewGOContext(nil)
184-
context.Request.SetRequest(request)
185-
c := NewController(context)
183+
context := NewGOContext(nil)
184+
context.Request.SetRequest(request)
185+
c := NewController(context)
186186

187187
return c.Request
188188
}

results_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ func TestBenchmarkRender(t *testing.T) {
1515
startFakeBookingApp()
1616
resp := httptest.NewRecorder()
1717

18-
context := NewGOContext(nil)
19-
context.Request.SetRequest(showRequest)
20-
context.Response.SetResponse(resp)
21-
c := NewController(context)
18+
context := NewGOContext(nil)
19+
context.Request.SetRequest(showRequest)
20+
context.Response.SetResponse(resp)
21+
c := NewController(context)
2222
if err := c.SetAction("Hotels", "Show"); err != nil {
2323
t.Errorf("SetAction failed: %s", err)
2424
}
@@ -33,10 +33,10 @@ func BenchmarkRenderChunked(b *testing.B) {
3333
startFakeBookingApp()
3434
resp := httptest.NewRecorder()
3535
resp.Body = nil
36-
context := NewGOContext(nil)
37-
context.Request.SetRequest(showRequest)
38-
context.Response.SetResponse(resp)
39-
c := NewController(context)
36+
context := NewGOContext(nil)
37+
context.Request.SetRequest(showRequest)
38+
context.Response.SetResponse(resp)
39+
c := NewController(context)
4040
if err := c.SetAction("Hotels", "Show"); err != nil {
4141
b.Errorf("SetAction failed: %s", err)
4242
}
@@ -53,10 +53,10 @@ func BenchmarkRenderNotChunked(b *testing.B) {
5353
startFakeBookingApp()
5454
resp := httptest.NewRecorder()
5555
resp.Body = nil
56-
context := NewGOContext(nil)
57-
context.Request.SetRequest(showRequest)
58-
context.Response.SetResponse(resp)
59-
c := NewController(context)
56+
context := NewGOContext(nil)
57+
context.Request.SetRequest(showRequest)
58+
context.Response.SetResponse(resp)
59+
c := NewController(context)
6060
if err := c.SetAction("Hotels", "Show"); err != nil {
6161
b.Errorf("SetAction failed: %s", err)
6262
}

router_test.go

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,9 @@ func TestRouteMatches(t *testing.T) {
267267
for req, expected := range routeMatchTestCases {
268268
t.Log("Routing:", req.Method, req.URL)
269269

270-
context := NewGOContext(nil)
271-
context.Request.SetRequest(req)
272-
c := NewController(context)
270+
context := NewGOContext(nil)
271+
context.Request.SetRequest(req)
272+
c := NewController(context)
273273

274274
actual := router.Route(c.Request)
275275
if !eq(t, "Found route", actual != nil, expected != nil) {
@@ -371,9 +371,9 @@ func BenchmarkRouter(b *testing.B) {
371371
b.ResetTimer()
372372
for i := 0; i < b.N/len(routeMatchTestCases); i++ {
373373
for req := range routeMatchTestCases {
374-
context := NewGOContext(nil)
375-
context.Request.SetRequest(req)
376-
c := NewController(context)
374+
context := NewGOContext(nil)
375+
context.Request.SetRequest(req)
376+
c := NewController(context)
377377
r := router.Route(c.Request)
378378
if r == nil {
379379
b.Errorf("Request not found: %s", req.URL.Path)
@@ -427,9 +427,9 @@ func BenchmarkLargeRouter(b *testing.B) {
427427

428428
for i := 0; i < b.N/len(reqs); i++ {
429429
for _, req := range reqs {
430-
context := NewGOContext(nil)
431-
context.Request.SetRequest(req)
432-
c := NewController(context)
430+
context := NewGOContext(nil)
431+
context.Request.SetRequest(req)
432+
c := NewController(context)
433433

434434
route := router.Route(c.Request)
435435
if route == nil {
@@ -441,13 +441,12 @@ func BenchmarkLargeRouter(b *testing.B) {
441441

442442
func BenchmarkRouterFilter(b *testing.B) {
443443
startFakeBookingApp()
444-
context := NewGOContext(nil)
445-
context.Request.SetRequest(showRequest)
446-
c1 := NewController(context)
447-
context = NewGOContext(nil)
448-
context.Request.SetRequest(staticRequest)
449-
c2 := NewController(context)
450-
444+
context := NewGOContext(nil)
445+
context.Request.SetRequest(showRequest)
446+
c1 := NewController(context)
447+
context = NewGOContext(nil)
448+
context.Request.SetRequest(staticRequest)
449+
c2 := NewController(context)
451450

452451
controllers := []*Controller{
453452
c1,
@@ -469,9 +468,9 @@ func BenchmarkRouterFilter(b *testing.B) {
469468
func TestOverrideMethodFilter(t *testing.T) {
470469
req, _ := http.NewRequest("POST", "/hotels/3", strings.NewReader("_method=put"))
471470
req.Header.Set("Content-Type", "application/x-www-form-urlencoded; param=value")
472-
context := NewGOContext(nil)
473-
context.Request.SetRequest(req)
474-
c := NewController(context)
471+
context := NewGOContext(nil)
472+
context.Request.SetRequest(req)
473+
c := NewController(context)
475474

476475
if HTTPMethodOverride(c, NilChain); c.Request.Method != "PUT" {
477476
t.Errorf("Expected to override current method '%s' in route, found '%s' instead", "", c.Request.Method)

simplestack_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type SimpleStackTest struct {
99
}
1010

1111
func TestUnique(b *testing.T) {
12-
stack := NewStackLock(10,40, func() interface{} {
12+
stack := NewStackLock(10, 40, func() interface{} {
1313
newone := &SimpleStackTest{}
1414
return newone
1515
})
@@ -62,7 +62,7 @@ func TestUnique(b *testing.T) {
6262

6363
}
6464
func TestLimits(b *testing.T) {
65-
stack := NewStackLock(10,20, func() interface{} {
65+
stack := NewStackLock(10, 20, func() interface{} {
6666
newone := &SimpleStackTest{}
6767
return newone
6868
})
@@ -73,13 +73,13 @@ func TestLimits(b *testing.T) {
7373
if stack.active != 50 {
7474
b.Errorf("Failed to match 50 active %v ", stack.active)
7575
}
76-
for _,v := range values {
77-
stack.Push(v)
78-
}
76+
for _, v := range values {
77+
stack.Push(v)
78+
}
7979
if stack.Capacity() != 20 {
8080
b.Errorf("Failed to match 20 capcity %v ", stack.Capacity())
8181
}
82-
82+
8383
}
8484
func isDifferent(values ...*SimpleStackTest) bool {
8585
if len(values) == 2 {
@@ -94,22 +94,22 @@ func isDifferent(values ...*SimpleStackTest) bool {
9494
}
9595

9696
func BenchmarkCreateWrite(b *testing.B) {
97-
stack := NewStackLock(0,40, func() interface{} { return &SimpleStackTest{} })
97+
stack := NewStackLock(0, 40, func() interface{} { return &SimpleStackTest{} })
9898
for x := 0; x < b.N; x++ {
9999
stack.Push(x)
100100
}
101101
}
102102
func BenchmarkAllocWrite(b *testing.B) {
103-
stack := NewStackLock(b.N,b.N+100, func() interface{} { return &SimpleStackTest{} })
103+
stack := NewStackLock(b.N, b.N+100, func() interface{} { return &SimpleStackTest{} })
104104
for x := 0; x < b.N; x++ {
105105
stack.Push(x)
106106
}
107107
}
108108
func BenchmarkCreate(b *testing.B) {
109-
NewStackLock(b.N,b.N+100, func() interface{} { return &SimpleStackTest{} })
109+
NewStackLock(b.N, b.N+100, func() interface{} { return &SimpleStackTest{} })
110110
}
111111
func BenchmarkParrallel(b *testing.B) {
112-
stack := NewStackLock(b.N,b.N+100, func() interface{} { return &SimpleStackTest{} })
112+
stack := NewStackLock(b.N, b.N+100, func() interface{} { return &SimpleStackTest{} })
113113
b.RunParallel(func(pb *testing.PB) {
114114
for pb.Next() {
115115
for x := 0; x < 50000; x++ {

validation_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ func getRecordedCookie(recorder *httptest.ResponseRecorder, name string) (*http.
2424

2525
func validationTester(req *Request, fn func(c *Controller)) *httptest.ResponseRecorder {
2626
recorder := httptest.NewRecorder()
27-
context := NewGOContext(nil)
28-
context.Request.SetRequest(req.In.GetRaw().(*http.Request))
29-
context.Response.SetResponse(recorder)
30-
c := NewController(context)
27+
context := NewGOContext(nil)
28+
context.Request.SetRequest(req.In.GetRaw().(*http.Request))
29+
context.Response.SetResponse(recorder)
30+
c := NewController(context)
3131

3232
ValidationFilter(c, []Filter{func(c *Controller, _ []Filter) {
3333
fn(c)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy