[gitg] Added test for commit message encoding



commit a6fe41eaab1b4eea30128d97ba1cf41fe4c69e7a
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Mon Jul 8 07:49:57 2013 +0200

    Added test for commit message encoding

 libgitg/tests/Makefile.am        |    3 +-
 libgitg/tests/main.vala          |    1 +
 libgitg/tests/test-encoding.vala |   67 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 70 insertions(+), 1 deletions(-)
---
diff --git a/libgitg/tests/Makefile.am b/libgitg/tests/Makefile.am
index 6f647b6..7ea6f01 100644
--- a/libgitg/tests/Makefile.am
+++ b/libgitg/tests/Makefile.am
@@ -26,7 +26,8 @@ test_libgitg_SOURCES =                                \
        repository.vala                         \
        test-stage.vala                         \
        test-date.vala                          \
-       test-commit.vala
+       test-commit.vala                        \
+       test-encoding.vala
 
 test_libgitg_CFLAGS = $(LIBGITG_CFLAGS) -w
 
diff --git a/libgitg/tests/main.vala b/libgitg/tests/main.vala
index c8d98c8..2b33ff3 100644
--- a/libgitg/tests/main.vala
+++ b/libgitg/tests/main.vala
@@ -29,6 +29,7 @@ class Gitg.Test.Main
                add(new Stage());
                add(new Date());
                add(new Commit());
+               add(new Encoding());
 
                GLib.Test.run();
        }
diff --git a/libgitg/tests/test-encoding.vala b/libgitg/tests/test-encoding.vala
new file mode 100644
index 0000000..2848433
--- /dev/null
+++ b/libgitg/tests/test-encoding.vala
@@ -0,0 +1,67 @@
+/*
+ * This file is part of gitg
+ *
+ * Copyright (C) 2013 - Jesse van den Kieboom
+ *
+ * gitg is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * gitg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with gitg. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+using Gitg.Test.Assert;
+
+class Gitg.Test.Encoding : Gitg.Test.Repository
+{
+       /**
+        * Create basic repository with files in a variety of states.
+        */
+       protected override void set_up()
+       {
+               base.set_up();
+
+               d_repository.get_config().set_string("i18n.commitencoding", "KOI8-R");
+
+               index_modify("b", "staged changes\n");
+               index_modify("a", "lala\n");
+       }
+
+       /**
+        * test commit.
+        */
+       protected virtual signal void test_commit_encoding()
+       {
+               var stage = d_repository.stage;
+               var loop = new MainLoop();
+
+               var sig = new Ggit.Signature.now("Jesse van den Kieboom",
+                                                "jessevdk gnome org");
+
+               var msg = "This is the commit\n\nWith some cyЯЯilic.\n";
+
+               stage.commit.begin(msg,
+                                  sig,
+                                  sig,
+                                  StageCommitOptions.NONE, (obj, res) => {
+
+                       var oid = stage.commit.end(res);
+                       var commit = d_repository.lookup<Gitg.Commit>(oid);
+
+                       assert_streq(commit.get_message(), msg);
+
+                       loop.quit();
+               });
+
+               loop.run();
+       }
+}
+
+// ex:set ts=4 noet


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]