Ejemplo n.º 1
0
        public void ParseQuotedSuccess(string source)
        {
            CharReader reader = new CharReader(source);

            Assert.True(reader.ReadTo(':', true, '"'));
            Assert.Equal("123", reader.GetRemainder().ToString());
        }
Ejemplo n.º 2
0
        public void CharReaderShouldSkipEscape()
        {
            string     source = "a\\:c:123";
            CharReader reader = new CharReader(source);

            reader.ReadTo(':', true);
            Assert.Equal(4, reader.Position);
        }
Ejemplo n.º 3
0
        public void CharReaderShouldReadToCharacter()
        {
            StringSegment source = new StringSegment("abc:123");
            CharReader    reader = new CharReader(source);

            reader.ReadTo(':', false);
            Assert.Equal(3, reader.Position);
        }
Ejemplo n.º 4
0
        public void CharReaderKeepsReadingAfterFoundPosition()
        {
            string     source = "abc:123";
            CharReader reader = new CharReader(source);

            reader.ReadTo(':', false);
            Assert.Equal('1', reader.Read());
        }
Ejemplo n.º 5
0
        public void CharReaderShouldBeAtEndIfItDoesNotFindChar()
        {
            string     source = "abc:123";
            CharReader reader = new CharReader(source);

            bool found = reader.ReadTo('?', false);

            Assert.False(found);
            Assert.True(reader.IsDone);
        }
Ejemplo n.º 6
0
        public void CharReaderNotAtEndIfFindsCharacter()
        {
            string     source = "abc:123";
            CharReader reader = new CharReader(source);

            bool found = reader.ReadTo(':', false);

            Assert.True(found);
            Assert.False(reader.IsDone);
        }
Ejemplo n.º 7
0
        public void ParseQuotedFail(string source)
        {
            CharReader reader = new CharReader(source);

            Assert.False(reader.ReadTo(':', true, '"'));
        }