Skip to content

Commit

Permalink
Also test identifiers in matches.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Feb 13, 2012
1 parent 8b9d57c commit ef6b8bf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/dynamo/router_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ defmodule Dynamo::RouterTest do
assert_quoted ['foo' | ['id-' ++ _ | _] = glob], R.generate_match('foo/id-*glob').segments
end

def test_generate_match_fails do
def test_generate_match_segments_and_identifiers do
match = R.generate_match('/foo/:bar/bar-*baz')
assert_quoted ['foo', bar | ['bar-' ++ _ | _] = baz], match.segments
assert_equal [:baz, :bar], match.identifiers
end

def test_generate_invalid_match_with_segments_after_glob do
R.generate_match('/foo/*bar/baz')
flunk "generate_match should have failed"
rescue: x in [Dynamo::Router::InvalidSpec]
Expand Down

0 comments on commit ef6b8bf

Please sign in to comment.