Beispiel #1
0
        void NextSecond_return_second()
        {
            var reader = new SourceStringReader("abc");

            reader.Advance();

            Assert.Equal('b', reader.CurrentChar());
        }
Beispiel #2
0
        void PeekAtStart_return_first()
        {
            var reader = new SourceStringReader("abc");

            var c = reader.CurrentChar();

            Assert.Equal('a', c);
        }
Beispiel #3
0
        void PeekAfterOneNext_return_second()
        {
            var reader = new SourceStringReader("abc");

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

            Assert.Equal('b', c);
        }
Beispiel #4
0
        void NextNonWhiteChar_at_start()
        {
            var reader = new SourceStringReader(" \t \r abc");

            var success = reader.AdvanceUntilNonWhite();

            Assert.True(success);

            Assert.Equal('a', reader.CurrentChar());
        }
Beispiel #5
0
        void PeekAtTheEOF_throws()
        {
            var reader = new SourceStringReader("abc");

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

            Assert.Throws <InvalidOperationException>(() => reader.CurrentChar());
        }
Beispiel #6
0
        void NextAtStart_return_first()
        {
            var reader = new SourceStringReader("abc");

            Assert.Equal('a', reader.CurrentChar());
        }