[gitg] Deterministic but ever increasing time for tests
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Deterministic but ever increasing time for tests
- Date: Thu, 13 Aug 2015 22:58:45 +0000 (UTC)
commit cb8dbf79df77fa803a983f50093ed15d50bfb74b
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Thu Aug 13 20:18:00 2015 +0200
Deterministic but ever increasing time for tests
tests/gitg/application-mock.vala | 13 -------------
tests/support/repository.vala | 28 ++++++++++++++++------------
2 files changed, 16 insertions(+), 25 deletions(-)
---
diff --git a/tests/gitg/application-mock.vala b/tests/gitg/application-mock.vala
index 452e3c6..a9c53c4 100644
--- a/tests/gitg/application-mock.vala
+++ b/tests/gitg/application-mock.vala
@@ -45,19 +45,6 @@ class Gitg.Test.Application : Gitg.Test.Repository, GitgExt.Application
public GitgExt.Activity? current_activity { owned get { return null; } }
public Gee.Map<string, string> environment { owned get { return new Gee.HashMap<string, string>(); } }
- public Ggit.Signature? get_verified_committer()
- {
- try
- {
- return new Ggit.Signature("test", "test test test", new DateTime.from_unix_utc(0));
- }
- catch (Error e)
- {
- assert_no_error(e);
- return null;
- }
- }
-
public Gee.ArrayList<SimpleNotification> simple_notifications
{
owned get
diff --git a/tests/support/repository.vala b/tests/support/repository.vala
index 0ff97dd..97115cb 100644
--- a/tests/support/repository.vala
+++ b/tests/support/repository.vala
@@ -22,6 +22,7 @@ using Gitg.Test.Assert;
class Gitg.Test.Repository : Gitg.Test.Test
{
protected Gitg.Repository? d_repository;
+ private uint d_current_time;
struct File
{
@@ -103,6 +104,19 @@ class Gitg.Test.Repository : Gitg.Test.Test
});
}
+ public Ggit.Signature? get_verified_committer()
+ {
+ try
+ {
+ return new Ggit.Signature("gitg tester", "gitg-tester gnome org", new
DateTime.from_unix_utc(d_current_time++));
+ }
+ catch (Error e)
+ {
+ assert_no_error(e);
+ return null;
+ }
+ }
+
protected void commit(string? filename, ...)
{
if (d_repository == null)
@@ -153,18 +167,7 @@ class Gitg.Test.Repository : Gitg.Test.Test
}
// create commit
- Ggit.Signature sig;
-
- try
- {
- sig = new Ggit.Signature.now("gitg tester",
- "gitg-tester gnome org");
- }
- catch (GLib.Error e)
- {
- assert_no_error(e);
- return;
- }
+ var sig = get_verified_committer();
Ggit.Tree tree;
@@ -348,6 +351,7 @@ class Gitg.Test.Repository : Gitg.Test.Test
protected override void set_up()
{
string wd;
+ d_current_time = 0;
try
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]