Beispiel #1
0
        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 );
        }
Beispiel #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 );
        }