Skip to content

Commit

Permalink
Merge branch 'template-regexp' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
sporkmonger committed Jul 3, 2021
2 parents cf8884f + b48ff03 commit 89c7613
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/addressable/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Template
Addressable::URI::CharacterClasses::DIGIT + '_'

var_char =
"(?:(?:[#{variable_char_class}]|%[a-fA-F0-9][a-fA-F0-9])+)"
"(?>(?:[#{variable_char_class}]|%[a-fA-F0-9][a-fA-F0-9])+)"
RESERVED =
"(?:[#{anything}]|%[a-fA-F0-9][a-fA-F0-9])"
UNRESERVED =
Expand Down
9 changes: 9 additions & 0 deletions spec/addressable/template_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
require "spec_helper"

require "bigdecimal"
require "timeout"
require "addressable/template"

shared_examples_for 'expands' do |tests|
Expand Down Expand Up @@ -1340,6 +1341,14 @@ def self.match(name)
expect(subject).not_to match("foo_bar*")
expect(subject).not_to match("foo_bar:20")
end

it 'should parse in a reasonable time' do
expect do
Timeout.timeout(0.1) do
expect(subject).not_to match("0"*25 + "!")
end
end.not_to raise_error
end
end
context "VARIABLE_LIST" do
subject { Addressable::Template::VARIABLE_LIST }
Expand Down

0 comments on commit 89c7613

Please sign in to comment.