public void TestIdChainParse() { IdentChainLexer l = new IdentChainLexer("Id1"); Assert.IsTrue(l.Parse(), "Не пропускает Id1"); l = new IdentChainLexer("Id1.Id2"); Assert.IsTrue(l.Parse(), "Не пропускает Id1.Id2"); l = new IdentChainLexer("uUd.k_22.sa3"); Assert.IsTrue(l.Parse(), "Не пропускает uUd.k_22.sa3"); }
public void TestIdChainFail() { IdentChainLexer l = new IdentChainLexer("3Id1"); Assert.Throws <LexerException>(() => { l.Parse(); }, "Пропускает 3Id1"); l = new IdentChainLexer(".Id2"); Assert.Throws <LexerException>(() => { l.Parse(); }, "Пропускает .Id2"); l = new IdentChainLexer("uUd."); Assert.Throws <LexerException>(() => { l.Parse(); }, "Пропускает uUd."); l = new IdentChainLexer("uUd.3sa"); Assert.Throws <LexerException>(() => { l.Parse(); }, "Пропускает uUd.3sa"); l = new IdentChainLexer("uUd. _sa"); Assert.Throws <LexerException>(() => { l.Parse(); }, "Пропускает uUd. _sa"); l = new IdentChainLexer("uUd,sa"); Assert.Throws <LexerException>(() => { l.Parse(); }, "Пропускает uUd,sa"); }