Add some more tests, and properly handle errors across the boundary in tests

This commit is contained in:
wycats
2010-11-25 16:09:42 -08:00
parent 4624eddf0b
commit 7d0204bf9f
3 changed files with 35 additions and 8 deletions
+6 -6
View File
@@ -117,11 +117,11 @@ describe "Tokenizer" do
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)
it "does not time out in a mustache with a single } followed by EOF" do
Timeout.timeout(1) { tokenize("{{foo}").should match_tokens(%w(OPEN ID)) }
end
it "does not time out in a mustache when invalid ID characters are used" do
Timeout.timeout(1) { tokenize("{{foo & }}").should match_tokens(%w(OPEN ID)) }
end
end