[banshee] MediaEngineTests: improve information about failed tests
- From: Andrés Aragoneses <aaragoneses src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] MediaEngineTests: improve information about failed tests
- Date: Mon, 20 Jan 2014 01:48:28 +0000 (UTC)
commit 36c9677192b938ffa89f145b6902d3ecdbdb222f
Author: Andrés G. Aragoneses <knocte gmail com>
Date: Mon Jan 20 01:36:34 2014 +0100
MediaEngineTests: improve information about failed tests
The AssertionException recently captured in previous commit had
line numbers referring to the exact place in the
Action<PlayerEventArgs> handler where it failed, but its stack
trace didn't go deep enough to tell us which lines the callers
of AssertTransition come from.
The way to fix it is to create a new exception object in the
non-handler thread, which copies the exception message of the
captured assertion exception (and stores it as inner exception
too, just in case).
We also add a message to the Asserts in the handler in order
to distinguish better if we're comparing an event or a state.
.../Banshee.Services/Banshee.MediaEngine/Tests.cs | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.MediaEngine/Tests.cs
b/src/Core/Banshee.Services/Banshee.MediaEngine/Tests.cs
index 7f299da..62aae88 100644
--- a/src/Core/Banshee.Services/Banshee.MediaEngine/Tests.cs
+++ b/src/Core/Banshee.Services/Banshee.MediaEngine/Tests.cs
@@ -191,11 +191,12 @@ namespace Banshee.MediaEngine
var evnt = (states[result_count] as PlayerEvent?) ?? PlayerEvent.StateChange;
var state = states[result_count] as PlayerState?;
- result_count++;
- Assert.AreEqual (evnt, last_event);
+ Assert.That (last_event, Is.EqualTo (evnt), String.Format ("Event[{0}] doesn't
match", result_count));
if (state != null) {
- Assert.AreEqual (state, last_state);
+ Assert.That (last_state, Is.EqualTo (state), String.Format ("State[{0}] doesn't
match", result_count));
}
+
+ result_count++;
}
}
reset_event.Set ();
@@ -221,7 +222,7 @@ namespace Banshee.MediaEngine
break;
}
if (exception != null) {
- throw exception;
+ throw new AssertionException (exception.Message, exception);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]