public void FormatSpecInDoubleBracesIsIgnored()
        {
            String input  = "\"" + @"Value: {{0}}" + "\"";
            var    parser = new CSharpStringScanner(input);

            Assert.Equal(null, parser.Next());
        }
        public void EscapeSequenceInVerbatimInterpolatedStringIsIgnored()
        {
            String input  = "$@\"some\\a value\"";
            var    parser = new CSharpStringScanner(input);

            Assert.Equal(null, parser.Next());
        }
Ejemplo n.º 3
0
        public void X1EscapeSequenceIsExtracted()
        {
            String input  = "\"" + @"some\x1string" + "\"";
            var    parser = new CSharpStringScanner(input);

            Assert.Equal(new StringPart(5, 3), parser.Next());
            Assert.Equal(null, parser.Next());
        }
Ejemplo n.º 4
0
        public void EscapeInSingleQuotesIsExtracted()
        {
            String input  = @"'some\rstring'";
            var    parser = new CSharpStringScanner(input);

            Assert.Equal(new StringPart(5, 2), parser.Next());
            Assert.Equal(null, parser.Next());
        }
Ejemplo n.º 5
0
        public void EscapedBackslashIsExtractedCorrectly()
        {
            String input  = "\"" + @"some\\string" + "\"";
            var    parser = new CSharpStringScanner(input);

            Assert.Equal(new StringPart(5, 2), parser.Next());
            Assert.Equal(null, parser.Next());
        }
Ejemplo n.º 6
0
        public void FormatSpecWithTypePrecisionAndAlignmentIsExtracted()
        {
            String input  = "\"" + @"Value: {0,-3:x2}" + "\"";
            var    parser = new CSharpStringScanner(input);

            Assert.Equal(new StringPart(8, 9, StringPartType.FormatSpecifier), parser.Next());
            Assert.Equal(null, parser.Next());
        }
Ejemplo n.º 7
0
        public void FormatSpecWithTypeIsExtracted()
        {
            String input  = "\"" + @"Value: {0:c}" + "\"";
            var    parser = new CSharpStringScanner(input);

            Assert.Equal(new StringPart(8, 5, StringPartType.FormatSpecifier), parser.Next());
            Assert.Equal(null, parser.Next());
        }
Ejemplo n.º 8
0
        public void SimpleFormatSpecifierIsExtracted()
        {
            String input  = "\"" + @"Hello {0}" + "\"";
            var    parser = new CSharpStringScanner(input);

            Assert.Equal(new StringPart(7, 3, StringPartType.FormatSpecifier), parser.Next());
            Assert.Equal(null, parser.Next());
        }
        public void EscapeSequenceAfterInterpolatedBlockIsExtracted()
        {
            String input  = "$\"some{value}\\a\"";
            var    parser = new CSharpStringScanner(input);

            Assert.Equal(new StringPart(13, 2), parser.Next());
            Assert.Equal(null, parser.Next());
        }
Ejemplo n.º 10
0
        public void FormatSpecsInVerbatimStringIsExtracted()
        {
            String input  = "@\"" + @"Value: {0}" + "\"";
            var    parser = new CSharpStringScanner(input);

            Assert.Equal(new StringPart(9, 3, StringPartType.FormatSpecifier), parser.Next());
            Assert.Equal(null, parser.Next());
        }
Ejemplo n.º 11
0
        public void TwoSeparateEscapeSequencesAreExtracted()
        {
            String input  = "\"" + @"some\rother\nstring" + "\"";
            var    parser = new CSharpStringScanner(input);

            Assert.Equal(new StringPart(5, 2), parser.Next());
            Assert.Equal(new StringPart(12, 2), parser.Next());
            Assert.Equal(null, parser.Next());
        }
Ejemplo n.º 12
0
        public void BracesInDifferentLinesAreIgnoredAsFormatSpecs()
        {
            String input = "\"public interface IBar\r\n"
                           + "{\r\n"
                           + "   Task Foo();\r\n"
                           + "}\"";
            var parser = new CSharpStringScanner(input);

            Assert.Equal(null, parser.Next());
        }