mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
fixed test method, fixed test examples that should parse
This commit is contained in:
parent
9f0849986b
commit
e3d9e012ad
1 changed files with 4 additions and 4 deletions
|
@ -22,7 +22,7 @@ class CompileTest < Test::Unit::TestCase
|
||||||
it "does not parse #{example} with #{pattern}" do
|
it "does not parse #{example} with #{pattern}" do
|
||||||
compiled, _ = compiled pattern
|
compiled, _ = compiled pattern
|
||||||
match = compiled.match(example)
|
match = compiled.match(example)
|
||||||
fail unless match.nil? || match.captures.empty?
|
fail %Q{"#{pattern}" does parse "#{example}" but it should fail} unless match.nil?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def compiled pattern
|
def compiled pattern
|
||||||
|
@ -32,7 +32,7 @@ class CompileTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
converts "/", %r{\A/\z}
|
converts "/", %r{\A/\z}
|
||||||
parses "/", "/", {}
|
parses "/", "/", {}
|
||||||
|
|
||||||
converts "/foo", %r{\A/foo\z}
|
converts "/foo", %r{\A/foo\z}
|
||||||
parses "/foo", "/foo", {}
|
parses "/foo", "/foo", {}
|
||||||
|
@ -47,7 +47,7 @@ class CompileTest < Test::Unit::TestCase
|
||||||
fails "/:foo", "/foo/"
|
fails "/:foo", "/foo/"
|
||||||
|
|
||||||
# converts "/f\u00F6\u00F6", %r{\A/f%C3%B6%C3%B6\z} # TODO Fails in Ruby 1.8
|
# converts "/f\u00F6\u00F6", %r{\A/f%C3%B6%C3%B6\z} # TODO Fails in Ruby 1.8
|
||||||
fails "/f\u00F6\u00F6", "/f%C3%B6%C3%B6"
|
parses "/f\u00F6\u00F6", "/f%C3%B6%C3%B6", {}
|
||||||
|
|
||||||
converts "/:foo/:bar", %r{\A/([^/?#]+)/([^/?#]+)\z}
|
converts "/:foo/:bar", %r{\A/([^/?#]+)/([^/?#]+)\z}
|
||||||
parses "/:foo/:bar", "/foo/bar", "foo" => "foo", "bar" => "bar"
|
parses "/:foo/:bar", "/foo/bar", "foo" => "foo", "bar" => "bar"
|
||||||
|
@ -73,7 +73,7 @@ class CompileTest < Test::Unit::TestCase
|
||||||
parses "/:foo/:bar", "/user@example.com/name", "foo" => "user@example.com", "bar" => "name"
|
parses "/:foo/:bar", "/user@example.com/name", "foo" => "user@example.com", "bar" => "name"
|
||||||
|
|
||||||
converts "/test$/", %r{\A/test(?:\$|%24)/\z}
|
converts "/test$/", %r{\A/test(?:\$|%24)/\z}
|
||||||
fails "/test$/", "/test$/"
|
parses "/test$/", "/test$/", {}
|
||||||
|
|
||||||
converts "/te+st/", %r{\A/te(?:\+|%2B)st/\z}
|
converts "/te+st/", %r{\A/te(?:\+|%2B)st/\z}
|
||||||
parses "/te+st/", "/te+st/", {}
|
parses "/te+st/", "/te+st/", {}
|
||||||
|
|
Loading…
Add table
Reference in a new issue