public void SingleLineCommentAnnotatedPropertyValue() { var content = "a {\n color: black; // red\n}"; var expected = new CategorisedCharacterString[] { CSS.SelectorOrStyleProperty("a", 0), CSS.Whitespace(" ", 1), CSS.OpenBrace(2), CSS.Whitespace("\n ", 3), CSS.SelectorOrStyleProperty("color", 6), CSS.StylePropertyColon(11), CSS.Whitespace(" ", 12), CSS.Value("black", 13), CSS.SemiColon(18), CSS.Whitespace(" ", 19), CSS.Comment("// red\n", 20), CSS.CloseBrace(27) }; Assert.Equal( expected, Parser.ParseLESS(content), new CategorisedCharacterStringComparer() ); }
public void CommentedOutPropertyValue() { var content = "a { color: /*black*/ red; }"; var expected = new CategorisedCharacterString[] { CSS.SelectorOrStyleProperty("a", 0), CSS.Whitespace(" ", 1), CSS.OpenBrace(2), CSS.Whitespace(" ", 3), CSS.SelectorOrStyleProperty("color", 4), CSS.StylePropertyColon(9), CSS.Whitespace(" ", 10), CSS.Comment("/*black*/", 11), CSS.Whitespace(" ", 20), CSS.Value("red", 21), CSS.SemiColon(24), CSS.Whitespace(" ", 25), CSS.CloseBrace(26) }; Assert.Equal( expected, Parser.ParseLESS(content), new CategorisedCharacterStringComparer() ); }
public void TerminatingLineReturnIsPartOfSingleLineComment() { var content = "// Comment\nbody { }"; var expected = new CategorisedCharacterString[] { CSS.Comment("// Comment\n", 0), CSS.SelectorOrStyleProperty("body", 11), CSS.Whitespace(" ", 15), CSS.OpenBrace(16), CSS.Whitespace(" ", 17), CSS.CloseBrace(18) }; Assert.Equal( expected, Parser.ParseLESS(content), new CategorisedCharacterStringComparer() ); }
public void NonContainedLineReturnIsNotPartOfMultiLineComment() { var content = "/* Comment */\nbody { }"; var expected = new CategorisedCharacterString[] { CSS.Comment("/* Comment */", 0), CSS.Whitespace("\n", 13), CSS.SelectorOrStyleProperty("body", 14), CSS.Whitespace(" ", 18), CSS.OpenBrace(19), CSS.Whitespace(" ", 20), CSS.CloseBrace(21) }; Assert.Equal( expected, Parser.ParseLESS(content), new CategorisedCharacterStringComparer() ); }