From 82cecbf042b8022db9968484c48c90aa6de8dd88 Mon Sep 17 00:00:00 2001 From: Corey Johnson & Nathan Sobo Date: Fri, 28 Sep 2012 09:05:51 -0700 Subject: [PATCH] Add test for situation where we infinitely looped --- spec/app/text-mate-grammar-spec.coffee | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/app/text-mate-grammar-spec.coffee b/spec/app/text-mate-grammar-spec.coffee index 0c834587d..a2e350c31 100644 --- a/spec/app/text-mate-grammar-spec.coffee +++ b/spec/app/text-mate-grammar-spec.coffee @@ -107,6 +107,13 @@ describe "TextMateGrammar", -> {tokens} = grammar.getLineTokens('') expect(tokens[0]).toEqual value: '', scopes: ["source.coffee"] + describe "when the line matches no patterns", -> + it "does not infinitely loop", -> + grammar = TextMateBundle.grammarForFileName("sample.txt") + {tokens} = grammar.getLineTokens('hoo') + expect(tokens.length).toBe 1 + expect(tokens[0]).toEqual value: 'hoo', scopes: ["text.plain", "meta.paragraph.text"] + describe "when the line matches a pattern with a 'contentName'", -> it "creates tokens using the content of contentName as the token name", -> grammar = TextMateBundle.grammarForFileName("sample.txt")