Ejemplo n.º 1
0
        void AssertColorization(string code, params SyntaxColor[] expectedColors)
        {
            var mi = new MachineInfo();

            mi.AddInternalFunction("void delay()");
            mi.HeaderCode = "#define FOO 1\n\nvoid delay();\n\n";
            var colors = CLanguageService.Colorize(code, mi);

            Assert.AreEqual(expectedColors.Length, colors.Length);
            for (int i = 0; i < colors.Length; i++)
            {
                var color  = colors[i];
                var ecolor = expectedColors[i];
                Assert.IsTrue(color.Length > 0, "Span has length = 0");
                Assert.AreEqual(ecolor, color.Color);
            }
        }