示例#1
0
文件: Program.cs 项目: mdcuesta/Ongle
        static void Main( string[] args )
        {
            string scriptFile = "";
            bool debug = false;

            foreach ( string arg in args )
            {
                if (arg == "-debug" || arg == "-d")
                {
                    Console.WriteLine ( "debuggin" );
                    debug = true;
                }
                else
                    scriptFile = arg;
            }

            if (scriptFile == "")
                Console.WriteLine ( "Specify the script file to run" );

            IKernel kernel = RunModule.GetKernel();
            kernel.Get <IDebugInfo> ().PrintToConsole = debug;

            RunOngle ongle = new RunOngle (kernel);
            FileStream stream = new FileStream ( args[0], FileMode.Open);
            ongle.Run ( stream );
        }
示例#2
0
        public void SimplePrintTest()
        {
            IKernel kernel = TestModule.GetTestKernel ();
            RunOngle target = new RunOngle ( kernel );

            string line =
            @"x = 5
            print 5";
            MemoryStream stream = new MemoryStream ( new System.Text.ASCIIEncoding ().GetBytes ( line ) );

            target.Run ( stream );

            StandardOutDummy output = kernel.Get<IStandardOut> () as StandardOutDummy;
            Assert.AreEqual ( "5", output.Text );
        }