Exemplo n.º 1
0
        public void TestIntAction()
        {
            var source = @"
Tokens
	Int = '0'|([1-9][0-9]*);

Productions expr
    expr       =  ""1"" a  { Add($0:string, $1); }
    a          = Int   { new Integer($0); }
         ;
";
            var logger = new LoggerMock();
            var inPath = "tmp.txt";

            File.WriteAllText(inPath, source);
            var compiler = new Opal.Compiler(logger, inPath)
            {
                OutPath = "tmp.out"
            };

            compiler.Compile();

            var msg = logger.ToString();

            Assert.IsNotNull(msg);

            var result = File.ReadAllText(compiler.OutPath);

            Assert.IsNotNull(result);
        }