Beispiel #1
0
        private async Task <GlobalContext> MakeModule(string code)
        {
            Parser parser = new Parser(
                new StreamReader(
                    new MemoryStream(
                        Encoding.UTF8.GetBytes(code)
                        )
                    )
                );
            TopLevel module = await parser.ParseModule();

            Assert.NotNull(module);
            return(await Compiler.CompileModule(module, null));
        }
Beispiel #2
0
        public async Task RunTestFromFile(string filename)
        {
            Compiler.ExposeAssembly(Assembly.GetExecutingAssembly());

            Parser   parser = new Parser(new StreamReader("FileTests/" + filename));
            TopLevel top    = await parser.ParseModule(
                Path.GetFileNameWithoutExtension(filename)
                );

            GlobalContext context = await Compiler.CompileModule(
                top,
                new DirectoryResourceProvider("FileTests/")
                );

            Lambda lambda = context.LookupVariable("testMain") as Lambda;

            Assert.NotNull(lambda);

            RAssert assert = new RAssert();

            lambda.Run(assert);
            Assert.NotEqual(0, assert.AssertionsCount);
        }