public void TextAndExpressionInterleaved() { var line = Tools.CreateFileLine(@"\A#{B}C#{D}E", 0); var rule = new InterpolationRule(); List <AsbtractRenderCommand> fragments = rule.Parse(line, new NullMessageHandler()); Assert.AreEqual(6, fragments.Count); Assert.AreEqual(RenderCommandTypes.TargetIndentation, fragments[0].Type); Assert.AreEqual("", fragments[0].Span.Text); Assert.AreEqual(RenderCommandTypes.OriginText, fragments[1].Type); Assert.AreEqual("A", fragments[1].Span.Text); Assert.AreEqual(RenderCommandTypes.OriginExpression, fragments[2].Type); Assert.AreEqual("B", fragments[2].Span.Text); Assert.AreEqual(RenderCommandTypes.OriginText, fragments[3].Type); Assert.AreEqual("C", fragments[3].Span.Text); Assert.AreEqual(RenderCommandTypes.OriginExpression, fragments[4].Type); Assert.AreEqual("D", fragments[4].Span.Text); Assert.AreEqual(RenderCommandTypes.OriginText, fragments[5].Type); Assert.AreEqual("E", fragments[5].Span.Text); }
public void IncludePragmaNoFileDirective() { var line = Tools.CreateFileLine("#pragma include", 0); var rule = new PreprocessorRule(); List <AsbtractRenderCommand> fragments = rule.Parse(line, new NullMessageHandler()); Assert.AreEqual(1, fragments.Count); Assert.AreEqual(RenderCommandTypes.OriginScript, fragments[0].Type); Assert.AreEqual("#pragma include", fragments[0].Span.Text); }
public void Text() { var line = Tools.CreateFileLine(@"A B", 0); var rule = new PassThroughRule(); List <AsbtractRenderCommand> fragments = rule.Parse(line, new NullMessageHandler()); Assert.AreEqual(1, fragments.Count); Assert.AreEqual(RenderCommandTypes.OriginScript, fragments[0].Type); Assert.AreEqual("A B", fragments[0].Span.Text); }
public void Empty() { var line = Tools.CreateFileLine(@"|", 0); var rule = new InterpolationLineRule(); List <AsbtractRenderCommand> fragments = rule.Parse(line, new NullMessageHandler()); Assert.AreEqual(3, fragments.Count); // ... // First elements are tested by InterpolationLine // ... Assert.AreEqual(RenderCommandTypes.TargetNewLine, fragments[2].Type); Assert.AreEqual("", fragments[2].Span.Text); }
public void IndentationText() { var line = Tools.CreateFileLine(@"\ A", 0); var rule = new InterpolationRule(); List <AsbtractRenderCommand> fragments = rule.Parse(line, new NullMessageHandler()); Assert.AreEqual(2, fragments.Count); Assert.AreEqual(RenderCommandTypes.TargetIndentation, fragments[0].Type); Assert.AreEqual(" ", fragments[0].Span.Text); Assert.AreEqual(RenderCommandTypes.OriginText, fragments[1].Type); Assert.AreEqual("A", fragments[1].Span.Text); }
public void Indentation() { var line = Tools.CreateFileLine(@"= A;", 0); var rule = new CallRule(); List <AsbtractRenderCommand> fragments = rule.Parse(line, new NullMessageHandler()); Assert.AreEqual(3, fragments.Count); Assert.AreEqual(RenderCommandTypes.TargetPushIndentation, fragments[0].Type); Assert.AreEqual(" ", fragments[0].Span.Text); Assert.AreEqual(RenderCommandTypes.OriginScript, fragments[1].Type); Assert.AreEqual("A;", fragments[1].Span.Text); Assert.AreEqual(RenderCommandTypes.TargetPopIndentation, fragments[2].Type); Assert.AreEqual("", fragments[2].Span.Text); }
public void EscapedSharp() { var line = Tools.CreateFileLine(@"\##include #{A}", 0); var rule = new InterpolationRule(); List <AsbtractRenderCommand> fragments = rule.Parse(line, new NullMessageHandler()); Assert.AreEqual(5, fragments.Count); Assert.AreEqual(RenderCommandTypes.TargetIndentation, fragments[0].Type); Assert.AreEqual("", fragments[0].Span.Text); Assert.AreEqual(RenderCommandTypes.OriginText, fragments[1].Type); Assert.AreEqual("#", fragments[1].Span.Text); Assert.AreEqual(RenderCommandTypes.OriginText, fragments[2].Type); Assert.AreEqual("include ", fragments[2].Span.Text); Assert.AreEqual(RenderCommandTypes.OriginExpression, fragments[3].Type); Assert.AreEqual("A", fragments[3].Span.Text); Assert.AreEqual(RenderCommandTypes.OriginText, fragments[4].Type); Assert.AreEqual("", fragments[4].Span.Text); }