The tokenizer shouldn't get into an infinite loop in certain termination conditions

This commit is contained in:
wycats
2010-11-25 12:46:25 -08:00
parent 3388962225
commit 4624eddf0b
3 changed files with 92 additions and 9 deletions
+8
View File
@@ -116,4 +116,12 @@ describe "Tokenizer" do
result.should match_tokens(%w(OPEN ID STRING CLOSE))
result[2].should be_token("STRING", %{bar"baz})
end
it "does not time out with broken input" do
lambda do
Timeout.timeout(1) do
tokenize("{{foo}")
end
end.should_not raise_error(Timeout::Error)
end
end