Ejemplo n.º 1
0
        public void ParsesFileWithTheLot()
        {
            var tokens      = new DjinniLexer();
            var productions = new Parser();
            var file        = new FileParser();

            var sections = file.Consume(
                productions.Consume(
                    tokens.Consume(
                        TestInputStrings.DirectiveAndTwoTypes)));

            CollectionAssert.AreEqual(
                new[]
            {
                FileSection.Directives,
                FileSection.Type,
                FileSection.Type
            },
                sections.Select(s => s.Kind).Where(k => k != FileSection.Empty));
        }