/snippets/aop/src/utests/lexing.n
http://github.com/saidai-no/nemerle · Unknown · 41 lines · 30 code · 11 blank · 0 comment · 0 complexity · 854fd6b7fb5df5afbd5a2a6d8fc86a5f MD5 · raw file
- #pragma indent
-
- using NUnit.Framework
- using Nemerle.Aop.Helper
- using Nemerle.Compiler
-
- [TestFixture] public class LexingTest
- [Test] public or_operator(): void
- def lexer = Lexer(Helper.ConvertToTokenLooseGroup(["||"]))
-
- match(lexer.Peek())
- | Token.Operator("||") => ()
- | _ => Assert.Fail("Peek operation fails")
-
- match(lexer.Pop())
- | Token.Operator("||") => ()
- | _ => Assert.Fail("Pop operation fails")
-
- match(lexer.Peek())
- | Token.Operator("||") => Assert.Fail("last token was not poped")
- | _ => ()
-
-
- [Test] public and_operator(): void
- def lexer = Lexer(Helper.ConvertToTokenLooseGroup(["&&"]))
-
- match(lexer.Peek())
- | Token.Operator("&&") => ()
- | sth => Assert.Fail($"Peek operation fails: $sth")
-
- [Test] public ellipsis_operator_is_not_splitted(): void
- def lexer = Lexer(Helper.ConvertToTokenLooseGroup([".."]))
-
- match(lexer.Peek())
- | Token.Operator("..") => ()
- | sth => Assert.Fail($"Peek operation fails: $sth")
-
- [Test] public drop_id(): void
- def lexer = Lexer(Helper.ConvertToTokenLooseGroup(["identyfikator"]))
- lexer.DropId("identyfikator");
- Assert.IsTrue(lexer.Empty)