Esempio n. 1
0
        protected virtual void assertToken(int expectedLineNumber, Type expectedClazz, String expectedValue)
        {
            Token token = lexer.next();

            Assert.AreEqual(token.getValue(), (expectedValue));
            Assert.AreEqual(token.getLineNumber(), (expectedLineNumber));
            Assert.AreEqual(token.GetType(), expectedClazz);
        }
Esempio n. 2
0
        public void shouldReturnALookaheadToken() //throws Exception
        {
            Token token = lexer1.next();

            assertThat(token.ToString(), ("div"));
            Assert.AreEqual(token.GetType(), typeof(Tag));

            token = lexer1.next();
            assertThat(token.ToString(), ("indent"));
            Assert.AreEqual(token.GetType(), typeof(Indent));

            token = lexer1.next();
            assertThat(token.ToString(), ("h1"));
            Assert.AreEqual(token.GetType(), typeof(Tag));

            token = lexer1.next();
            assertThat(token.ToString(), ("outdent"));
            Assert.AreEqual(token.GetType(), typeof(Outdent));

            token = lexer1.next();
            Assert.AreEqual(token.GetType(), typeof(Eos));
        }
Esempio n. 3
0
 public void shouldReturnAnEOFTagIfEmptyFile() //throws Exception
 {
     assertThat(lexer2.next().getValue(), ("eos"));
 }