예제 #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 );
        }