Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/guiunit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--src/framework/GuiUnit/GtkMainLoopIntegration.cs2
-rw-r--r--src/framework/GuiUnit/IMainLoopIntegration.cs2
-rw-r--r--src/framework/GuiUnit/MonoMacMainLoopIntegration.cs3
-rw-r--r--src/framework/GuiUnit/TestRunner.cs53
-rw-r--r--src/framework/GuiUnit/XwtMainLoopIntegration.cs9
-rwxr-xr-xsrc/framework/Runner/ResultReporter.cs6
7 files changed, 48 insertions, 30 deletions
diff --git a/.gitignore b/.gitignore
index c724a01..69f16d0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
.DS_Store
bin
+obj
src/framework/GuiUnit.userprefs
-src/framework/obj/*
*.userprefs
-src/TestResultConsole/obj/*
*.csproj.CoreCompileInputs.cache
diff --git a/src/framework/GuiUnit/GtkMainLoopIntegration.cs b/src/framework/GuiUnit/GtkMainLoopIntegration.cs
index 80ab3f5..bf59d30 100644
--- a/src/framework/GuiUnit/GtkMainLoopIntegration.cs
+++ b/src/framework/GuiUnit/GtkMainLoopIntegration.cs
@@ -60,7 +60,7 @@ namespace GuiUnit
Application.GetMethod ("Run").Invoke (null, null);
}
- public void Shutdown ()
+ public void Shutdown (int exitCode)
{
Application.GetMethod ("Quit").Invoke (null, null);
}
diff --git a/src/framework/GuiUnit/IMainLoopIntegration.cs b/src/framework/GuiUnit/IMainLoopIntegration.cs
index 4121c50..a51f4c8 100644
--- a/src/framework/GuiUnit/IMainLoopIntegration.cs
+++ b/src/framework/GuiUnit/IMainLoopIntegration.cs
@@ -7,7 +7,7 @@ namespace GuiUnit
void InitializeToolkit ();
void InvokeOnMainLoop (InvokerHelper helper);
void RunMainLoop ();
- void Shutdown ();
+ void Shutdown (int exitCode);
}
}
diff --git a/src/framework/GuiUnit/MonoMacMainLoopIntegration.cs b/src/framework/GuiUnit/MonoMacMainLoopIntegration.cs
index 6774694..4314dba 100644
--- a/src/framework/GuiUnit/MonoMacMainLoopIntegration.cs
+++ b/src/framework/GuiUnit/MonoMacMainLoopIntegration.cs
@@ -33,6 +33,7 @@ namespace GuiUnit
var errPtr = dlerror ();
var errStr = (errPtr == IntPtr.Zero)? "<unknown error>" : Marshal.PtrToStringAnsi (errPtr);
Console.WriteLine ("WARNING: Cannot load {0}: {1}", dylibPath, errStr);
+ throw new InvalidOperationException("Unable to initialize Xamarin.Mac");
}
var initMethod = Application.GetMethod ("Init", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
@@ -55,7 +56,7 @@ namespace GuiUnit
Application.GetMethod ("Run").Invoke (SharedApplication, null);
}
- public void Shutdown ()
+ public void Shutdown (int exitCode)
{
Application.GetMethod ("Terminate").Invoke (SharedApplication, new [] { SharedApplication });
}
diff --git a/src/framework/GuiUnit/TestRunner.cs b/src/framework/GuiUnit/TestRunner.cs
index 4661107..4ffd57b 100644
--- a/src/framework/GuiUnit/TestRunner.cs
+++ b/src/framework/GuiUnit/TestRunner.cs
@@ -83,6 +83,8 @@ namespace GuiUnit
private ITestAssemblyRunner runner;
+ private bool finished;
+
#region Constructors
/// <summary>
@@ -229,7 +231,8 @@ namespace GuiUnit
} catch (Exception ex) {
Console.WriteLine ("Unexpected error while running the tests: {0}", ex);
} finally {
- Shutdown ();
+ FinishTestExecution();
+ Shutdown();
}
});
MainLoop.RunMainLoop ();
@@ -239,6 +242,7 @@ namespace GuiUnit
catch (FileNotFoundException ex)
{
writer.WriteLine(ex.Message);
+ ExitCode = 1;
}
catch (Exception ex)
{
@@ -246,24 +250,34 @@ namespace GuiUnit
ExitCode = 1;
}
finally
- {
- if (commandLineOptions.OutFile == null)
- {
- if (commandLineOptions.Wait)
- {
- Console.WriteLine("Press Enter key to continue . . .");
- Console.ReadLine();
- }
- }
- else
- {
- writer.Close();
- }
- }
- }
+ {
+ FinishTestExecution();
+ }
+ }
}
- static void Shutdown ()
+ private void FinishTestExecution()
+ {
+ if (finished)
+ return;
+
+ finished = true;
+
+ if (commandLineOptions.OutFile == null)
+ {
+ if (commandLineOptions.Wait)
+ {
+ Console.WriteLine("Press Enter key to continue . . .");
+ Console.ReadLine();
+ }
+ }
+ else
+ {
+ writer.Close();
+ }
+ }
+
+ static void Shutdown ()
{
// Run the shutdown method on the main thread
var helper = new InvokerHelper {
@@ -273,8 +287,9 @@ namespace GuiUnit
BeforeShutdown (null, EventArgs.Empty);
} catch (Exception ex) {
Console.WriteLine ("Unexpected error during `BeforeShutdown`: {0}", ex);
+ ExitCode = 1;
} finally {
- MainLoop.Shutdown ();
+ MainLoop.Shutdown (ExitCode);
}
return null;
}
@@ -395,7 +410,7 @@ namespace GuiUnit
public void TestStarted(ITest test)
{
if (commandLineOptions.LabelTestsInOutput)
- writer.WriteLine("***** {0}", test.Name);
+ writer.WriteLine("***** {0}", test.FullName);
listener.TestStarted (test);
}
diff --git a/src/framework/GuiUnit/XwtMainLoopIntegration.cs b/src/framework/GuiUnit/XwtMainLoopIntegration.cs
index 7a74842..485cdfb 100644
--- a/src/framework/GuiUnit/XwtMainLoopIntegration.cs
+++ b/src/framework/GuiUnit/XwtMainLoopIntegration.cs
@@ -9,7 +9,6 @@ namespace GuiUnit
{
// List of Xwt backends we will try to use in order of priority
Tuple<string,string>[] backends = new[] {
- Tuple.Create ("Xwt.Gtk.dll", "Xwt.GtkBackend.GtkEngine, Xwt.Gtk"),
Tuple.Create ("Xwt.WPF.dll", "Xwt.WPFBackend.WPFEngine, Xwt.WPF"),
Tuple.Create ("Xwt.XamMac.dll", "Xwt.Mac.MacEngine, Xwt.XamMac")
};
@@ -68,9 +67,13 @@ namespace GuiUnit
Application.GetMethod ("Run").Invoke (null, null);
}
- public void Shutdown ()
+ public void Shutdown (int exitCode)
{
- Application.GetMethod ("Exit").Invoke (null, null);
+ var method = Application.GetMethod("Exit", new Type[] { typeof(int) });
+ if (method != null)
+ method.Invoke(null, new object[] { exitCode });
+ else
+ Application.GetMethod("Exit").Invoke(null, null);
}
}
diff --git a/src/framework/Runner/ResultReporter.cs b/src/framework/Runner/ResultReporter.cs
index 1a3b2b6..44a7227 100755
--- a/src/framework/Runner/ResultReporter.cs
+++ b/src/framework/Runner/ResultReporter.cs
@@ -65,12 +65,12 @@ namespace NUnitLite.Runner
{
PrintSummaryReport();
- if (summary.FailureCount > 0 || summary.ErrorCount > 0)
- PrintErrorReport();
-
if (summary.NotRunCount > 0)
PrintNotRunReport();
+ if (summary.FailureCount > 0 || summary.ErrorCount > 0)
+ PrintErrorReport();
+
//if (commandLineOptions.Full)
// PrintFullReport(result);
}