Permalink
Browse files

Add test case

  • Loading branch information...
1 parent 1f1336c commit c380ad4fbf446d3a44040453daf960b367db1531 @binlain binlain committed Oct 29, 2013
Showing with 9 additions and 0 deletions.
  1. +9 −0 tests/test-uricomponent.js
@@ -10,6 +10,9 @@ tree.define('/hello/:world/', function () {
tree.define('/colon/:test/definite/', function () {
})
+tree.define('/slashes/:foo/:bar', function () {
+})
+
var match = tree.match('/hello/dude')
assert.equal(match.params.world, 'dude')
@@ -23,3 +26,9 @@ assert.equal(match.params.test, 'hello world')
match = tree.match('/hello/notable%5Gtodecode')
assert.equal(match.params.world, 'notable%5Gtodecode') //when not a valid URI, it will just attach string verbatum
+
+match = tree.match('/slashes/this%2Fis/a%20test')
+console.log(match.perfect);
+assert.ok(match.perfect, 'should be a perfect match')
+assert.equal(match.params.foo, 'this/is', 'should have unsecaped slash') //Should have the decoded slash
+assert.equal(match.params.bar, 'a test', 'should have unescaped space') //Should have the decoded space

0 comments on commit c380ad4

Please sign in to comment.