~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/github.com/julienschmidt/httprouter/tree_test.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
                        maxParams = params
90
90
                }
91
91
        }
92
 
        if n.nType != static && !n.wildChild {
 
92
        if n.nType > root && !n.wildChild {
93
93
                maxParams++
94
94
        }
95
95
 
394
394
                "/1/:id/2",
395
395
                "/aa",
396
396
                "/a/",
 
397
                "/admin",
 
398
                "/admin/:category",
 
399
                "/admin/:category/:page",
397
400
                "/doc",
398
401
                "/doc/go_faq.html",
399
402
                "/doc/go1.html",
423
426
                "/0/go/",
424
427
                "/1/go",
425
428
                "/a",
 
429
                "/admin/",
 
430
                "/admin/config/",
 
431
                "/admin/config/permissions/",
426
432
                "/doc/",
427
433
        }
428
434
        for _, route := range tsrRoutes {
452
458
        }
453
459
}
454
460
 
 
461
func TestTreeRootTrailingSlashRedirect(t *testing.T) {
 
462
        tree := &node{}
 
463
 
 
464
        recv := catchPanic(func() {
 
465
                tree.addRoute("/:test", fakeHandler("/:test"))
 
466
        })
 
467
        if recv != nil {
 
468
                t.Fatalf("panic inserting test route: %v", recv)
 
469
        }
 
470
 
 
471
        handler, _, tsr := tree.getValue("/")
 
472
        if handler != nil {
 
473
                t.Fatalf("non-nil handler")
 
474
        } else if tsr {
 
475
                t.Errorf("expected no TSR recommendation")
 
476
        }
 
477
}
 
478
 
455
479
func TestTreeFindCaseInsensitivePath(t *testing.T) {
456
480
        tree := &node{}
457
481