var test = require('tape')
  , trailing = require('./index')

test('does not redirect when slashes match', function(t) {
  t.plan(1)

  var redirect = trailing(true, done)
    , res = {url: '/something/else/'}
    , req = {}

  redirect(res, req)

  function done(request) {
    t.ok(request)

    t.end()
  }
})

test('does not redirect when no slashes match', function(t) {
  t.plan(1)

  var redirect = trailing(false, done)
    , res = {url: '/something/else'}
    , req = {}

  redirect(res, req)

  function done(request) {
    t.ok(request)

    t.end()
  }
})

@@ -165,33 +165,33 @@
 , done)%0A    , re
-s
+q
  = %7Burl: '/somet
@@ -203,33 +203,33 @@
 else/'%7D%0A    , re
-q
+s
  = %7B%7D%0A%0A  redirec
@@ -224,38 +224,38 @@
 %7D%0A%0A  redirect(re
-s
+q
 , re
-q
+s
 )%0A%0A  function do
@@ -425,25 +425,25 @@
 ne)%0A    , re
-s
+q
  = %7Burl: '/s
@@ -462,25 +462,25 @@
 e'%7D%0A    , re
-q
+s
  = %7B%7D%0A%0A  red
@@ -491,14 +491,485 @@
 t(re
-s, req
+q, res)%0A%0A  function done(request) %7B%0A    t.ok(request)%0A%0A    t.end()%0A  %7D%0A%7D)%0A%0Atest('redirects when slash is missing', function(t) %7B%0A  t.plan(3)%0A%0A  var redirect = trailing(true, done)%0A    , req = %7Burl: '/something/else'%7D%0A    , res = %7B%0A          setHeader: function(name, value) %7B%0A            t.equal(name, 'Location')%0A            t.equal(value, req.url + '/')%0A          %7D%0A        , end: function() %7B%0A            t.ok(true)%0A            t.end()%0A        %7D%0A      %7D%0A%0A  redirect(req, res
 )%0A%0A 
@@ -982,32 +982,42 @@
 ion done(request
+, response
 ) %7B%0A    t.ok(req
@@ -1013,37 +1013,547 @@
    t.ok(
-request)%0A%0A    t.end()
+false) // fail if we reach here%0A  %7D%0A%7D)%0A%0Atest('redirects when slash is present', function(t) %7B%0A  t.plan(3)%0A%0A  var redirect = trailing(false, done)%0A    , req = %7Burl: '/something/else/'%7D%0A    , res = %7B%0A          setHeader: function(name, value) %7B%0A            t.equal(name, 'Location')%0A            t.equal(value, req.url.slice(0, -1))%0A          %7D%0A        , end: function() %7B%0A            t.ok(true)%0A            t.end()%0A        %7D%0A      %7D%0A%0A  redirect(req, res)%0A%0A  function done(request, response) %7B%0A    t.ok(false) // fail if we reach here
 %0A  %7D%0A%7D)%0A

Add remaining tests