Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fix URI matching tests

  • Loading branch information...
commit 0729bd45f7119b0e813a5cd3870d13344e9d8d79 1 parent e55a144
Stephen Sugden authored
2  lib/uri-template-matchpatch.coffee
@@ -12,7 +12,7 @@ queryStringOps = ['?', '&']
12 12
 
13 13
 Template::match = (input) ->
14 14
   if @prefix
15  
-    return false unless m = input.match '^' + @prefix
  15
+    return {} unless m = input.match '^' + @prefix
16 16
     input = input.substring m[0].length
17 17
   vars = {}
18 18
   aliases = {}
13  test/matching.test.coffee
@@ -6,12 +6,13 @@ assert = require 'assert'
6 6
 withTemplate = (tpl_string, tests) ->
7 7
   tpl = parser.parse tpl_string
8 8
   describe "compiled from #{tpl_string}", ->
9  
-    for url, result of tests
10  
-      it "matches #{url} to #{JSON.stringify result}", ->
11  
-        vars = tpl.match(url)
12  
-        assert.deepEqual vars, result
13  
-        if vars
14  
-          assert.equal tpl.expand(vars), url
  9
+    for url, expect of tests
  10
+      it "matches #{url} to #{JSON.stringify expect}", ->
  11
+        {vars} = tpl.match(url)
  12
+        if expect
  13
+          assert.deepEqual vars, expect
  14
+        else
  15
+          assert not vars
15 16
 
16 17
 describe 'A URI template', ->
17 18
   withTemplate '/{first}/{second}',

0 notes on commit 0729bd4

Please sign in to comment.
Something went wrong with that request. Please try again.