Exemplo n.º 1
0
        void PeekAtTheEOF_throws()
        {
            var reader = new SourceStringReader("abc");

            reader.Advance();
            reader.Advance();
            reader.Advance();

            Assert.Throws <InvalidOperationException>(() => reader.CurrentChar());
        }
Exemplo n.º 2
0
        void NextAtEnd_throws()
        {
            var reader = new SourceStringReader("abc");

            reader.Advance();
            reader.Advance();
            reader.Advance();

            Assert.Throws <InvalidOperationException>(() => reader.Advance());
        }
Exemplo n.º 3
0
        void Position_column_set_0_and_line_incr_1()
        {
            var source = "ab\nasd";
            var reader = new SourceStringReader(source);

            reader.Advance(); // a
            reader.Advance(); // b
            reader.Advance(); // This reads \n

            Assert.Equal(0, reader.Position.Column);
            Assert.Equal(1, reader.Position.Line);
        }
Exemplo n.º 4
0
        void NextSecond_return_second()
        {
            var reader = new SourceStringReader("abc");

            reader.Advance();

            Assert.Equal('b', reader.CurrentChar());
        }
Exemplo n.º 5
0
        void PeekAfterOneNext_return_second()
        {
            var reader = new SourceStringReader("abc");

            reader.Advance();
            var c = reader.CurrentChar();

            Assert.Equal('b', c);
        }
Exemplo n.º 6
0
        void PrevioutPositionTest()
        {
            var reader = new SourceStringReader("io");

            reader.Advance();

            Assert.Equal(0, reader.PreviousPosition.Column);
            Assert.Equal(0, reader.PreviousPosition.Line);
        }
Exemplo n.º 7
0
        void Position_column_increases_when_next()
        {
            var reader = new SourceStringReader("abc");

            reader.Advance();

            Assert.Equal(0, reader.Position.Line);
            Assert.Equal(1, reader.Position.Column);
        }