public void TestRunMain() { var Program = CompileProgram(@" int main(int argc, char **argv) { int n; printf(""%d\n"", argc - 1); for (n = 1; n < argc; n++) printf(""%s\n"", argv[n]); return 7; } " ); var Output = CaptureOutput(() => { #if false var Result = (int)Program.GetMethod("__startup").Invoke(null, new object[] { new string[] { "hello world!", "this is a test!" } }); #else var Result = CLibUtils.RunTypeMain(Program, new string[] { "hello world!", "this is a test!" }); #endif Assert.AreEqual(7, Result); }); Assert.AreEqual("2\nhello world!\nthis is a test!\n", Output); }
static public int TestCallRunTypeMain(string[] Args) { return(CLibUtils.RunTypeMain(typeof(CLibTest), Args)); }