public void TestCaseSensitivity() { LanguageRules.Symbols = new List <string>() { "abc" }; CodeColorizer colorizer = GetColorizer(LanguageRules); colorizer.Options.TokenFormat = "{1}"; Assert.AreEqual(" INT i ", colorizer.Transform(" INT i ")); Assert.AreEqual(" ABC def ", colorizer.Transform(" ABC def ")); LanguageRules.CaseSensitive = false; LanguageRules.Symbols = new List <string>() { "abc" }; colorizer = GetColorizer(LanguageRules); colorizer.Options.TokenFormat = "{1}"; Assert.AreEqual(" keyword i ", colorizer.Transform(" INT i ")); Assert.AreEqual(" symbol def ", colorizer.Transform(" ABC def ")); LanguageRules.Symbols = null; LanguageRules.CaseSensitive = true; }
public void TestStrings() { CodeColorizer colorizer = GetColorizer(LanguageRules); colorizer.Options.TokenFormat = "{1}"; Assert.AreEqual(" string ", colorizer.Transform(" \"abc\" ")); Assert.AreEqual(" string ", colorizer.Transform(" 'a' ")); }
public void TestComments() { CodeColorizer colorizer = GetColorizer(LanguageRules); colorizer.Options.TokenFormat = "{1}"; Assert.AreEqual(" comment", colorizer.Transform(" // Comment ")); Assert.AreEqual(" comment ", colorizer.Transform(" /* Comment */ ")); }
public void TestOperators() { CodeColorizer colorizer = GetColorizer(LanguageRules); colorizer.Options.TokenFormat = "{1}"; Assert.AreEqual(" a operator b operator c ", colorizer.Transform(" a = b * c ")); }
public void TestKeywords() { CodeColorizer colorizer = GetColorizer(LanguageRules); colorizer.Options.TokenFormat = "{1}"; Assert.AreEqual(" keyword i ", colorizer.Transform(" int i ")); }
public void TestSymbols() { CodeColorizer colorizer = GetColorizer(LanguageRules); colorizer.Options.TokenFormat = "{1}"; Assert.AreEqual(" abc def ", colorizer.Transform(" abc def ")); colorizer.Options.UnclassifiedDefaultToSymbols = true; Assert.AreEqual(" symbol symbol ", colorizer.Transform(" abc def ")); LanguageRules.Symbols = new List <string>() { "abc" }; colorizer = GetColorizer(LanguageRules); colorizer.Options.TokenFormat = "{1}"; Assert.AreEqual(" symbol def ", colorizer.Transform(" abc def ")); LanguageRules.Symbols = null; }
public void TestEmptyLanguage() { CodeColorizer colorizer = GetColorizer(new LanguageRules { CaseSensitive = false, SymbolFirstChars = null, SymbolChars = null, OperatorChars = null, }); Assert.AreEqual("string s = new string(); //", colorizer.Transform("string s = new string(); //")); }
public void BasicTest() { CodeColorizer colorizer = GetColorizer(LanguageRules); Assert.AreEqual(ColoredCode, colorizer.Transform(SampleCode)); }