callList() public method

public callList ( List args ) : object
args List
return object
Example #1
0
File: Fant.cs Project: nomit007/f4
        private int runTest(Type type, Method method)
        {
            Method setup    = type.method("setup", true);
              Method teardown = type.method("teardown", true);

              FanSysTest test = null;
              List args = null;
              try
              {
            test = (FanSysTest)type.make();
            args = new List(Sys.ObjType, new object[] {test});
              }
              catch (System.Exception e)
              {
            System.Console.WriteLine();
            System.Console.WriteLine("ERROR: Cannot make test " + type);
            if (e is Err.Val)
              ((Err.Val)e).err().trace();
            else
              Err.dumpStack(e);
            return -1;
              }

              try
              {
            test.m_curTestMethod = method;
            setup.callList(args);
            method.callList(args);
            return test.verifyCount;
              }
              catch (System.Exception e)
              {
            //System.Console.WriteLine(" -- " + e.GetType() + " -- ");
            System.Console.WriteLine();
            System.Console.WriteLine("TEST FAILED");
            if (e is Err.Val)
              ((Err.Val)e).err().trace();
            else
              Err.dumpStack(e);
            return -1;
              }
              finally
              {
            try
            {
              if (args != null) teardown.callList(args);
            }
            catch (System.Exception e)
            {
              Err.dumpStack(e);
            }
            test.m_curTestMethod = null;
              }
        }
Example #2
0
File: Fan.cs Project: xored/f4
        static int callMain(Type t, Method m)
        {
            // check parameter type and build main arguments
              List args;
              List pars = m.@params();
              if (pars.sz() == 0)
              {
            args = null;
              }
              else if (((Param)pars.get(0)).type().@is(Sys.StrType.toListOf()) &&
               (pars.sz() == 1 || ((Param)pars.get(1)).hasDefault()))
              {
            args = new List(Sys.ObjType, new object[] { Env.cur().args() });
              }
              else
              {
            System.Console.WriteLine("ERROR: Invalid parameters for main: " + m.signature());
            return -1;
              }

              // invoke
              try
              {
            if (m.isStatic())
              return toResult(m.callList(args));
            else
              return toResult(m.callOn(t.make(), args));
              }
              catch (Err.Val ex)
              {
            ex.err().trace();
            return -1;
              }
        }