[gnome-builder/wip/gtk4-port] tests: test argv API



commit 95b3ae21c44b022b029d75ddf8bc9b48d6d39583
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jun 17 01:36:26 2022 -0700

    tests: test argv API

 src/tests/test-run-context.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
---
diff --git a/src/tests/test-run-context.c b/src/tests/test-run-context.c
index ae2f6ba66..6ce8deb2d 100644
--- a/src/tests/test-run-context.c
+++ b/src/tests/test-run-context.c
@@ -98,6 +98,25 @@ test_run_context_environ (void)
   g_assert_finalize_object (run_context);
 }
 
+static void
+test_run_context_argv (void)
+{
+  IdeRunContext *run_context;
+
+  run_context = ide_run_context_new ();
+
+  ide_run_context_prepend_argv (run_context, "1");
+  ide_run_context_prepend_argv (run_context, "0");
+  ide_run_context_append_argv (run_context, "2");
+  ide_run_context_append_args (run_context, IDE_STRV_INIT ("3", "4"));
+  ide_run_context_prepend_args (run_context, IDE_STRV_INIT ("a", "b"));
+
+  g_assert_true (g_strv_equal (ide_run_context_get_argv (run_context),
+                               IDE_STRV_INIT ("a", "b", "0", "1", "2", "3", "4")));
+
+  g_assert_finalize_object (run_context);
+}
+
 static void
 test_run_context_default_handler (void)
 {
@@ -136,6 +155,7 @@ main (int   argc,
 {
   g_test_init (&argc, &argv, NULL);
   g_test_add_func ("/Ide/Foundry/RunContext/environ", test_run_context_environ);
+  g_test_add_func ("/Ide/Foundry/RunContext/argv", test_run_context_argv);
   g_test_add_func ("/Ide/Foundry/RunContext/default_handler", test_run_context_default_handler);
   return g_test_run ();
 }


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