Exemplo n.º 1
0
        public void TestCreateCodeFileFromSource()
        {
            var folderpath = Path.Combine(Path.GetTempPath(), "codefiletests");

            if (Directory.Exists(folderpath))
            {
                Directory.Delete(folderpath, true);
            }
            Directory.CreateDirectory(folderpath);

            File.WriteAllLines(Path.Combine(folderpath, "fn1.aplf"), new string[] {
                "fn1←{1×⍵}"
            });
            File.WriteAllLines(Path.Combine(folderpath, "fn2.aplf"), new string[] {
                " fn2←{",
                "    2×⍵",
                " }"
            });

            var interpreter = CreateInterpreter();
            var test1       = new CodeFile(interpreter);
            var codefile    = Path.Combine(folderpath, "fn1.dwx");

            try {
                test1.CreateCodeFileFromFolder(codefile, folderpath, 4);
            } finally {
                Directory.Delete(folderpath, true);
            }
            Assert.IsTrue(interpreter.Unload());
        }