From 5a557f9e513a3463abba713edf3bc32946deb8de Mon Sep 17 00:00:00 2001 From: Jeremy Wootten Date: Sun, 24 Nov 2024 13:45:41 +0000 Subject: [PATCH] Insert extra logging for tests --- src/tests/Application.vala | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/tests/Application.vala b/src/tests/Application.vala index 0e5415b6b7..68eb5e4b34 100644 --- a/src/tests/Application.vala +++ b/src/tests/Application.vala @@ -108,19 +108,23 @@ namespace Terminal.Test.Application { // local command line: any instance from terminal GLib.Test.add_func ("/application/cli/commandline", () => { +stdout.printf ("# Starting /application/cli/commandline\n"); cli ({ "io.elementary.terminal", "--commandline=true" }, (dict) => { +stdout.printf ("# Callback for cli 1\n"); assert_true ("commandline" in dict); unowned var commandline = dict.lookup_value ("commandline", null).get_bytestring (); assert_cmpstr (commandline, CompareOperator.EQ, "true"); }); cli ({ "io.elementary.terminal", "-x", "echo", "-e", "true\tfalse" }, (dict) => { +stdout.printf ("# Callback for cli 2\n"); assert_true ("commandline" in dict); unowned var commandline = dict.lookup_value ("commandline", null).get_bytestring (); assert_cmpstr (commandline, CompareOperator.EQ, "echo -e true\\tfalse"); }); cli ({ "io.elementary.terminal", "--commandline", "echo", "true" }, (dict) => { +stdout.printf ("# Callback for cli 3\n"); assert_true ("commandline" in dict); unowned var commandline = dict.lookup_value ("commandline", null).get_bytestring (); assert_cmpstr (commandline, CompareOperator.EQ, "echo true"); @@ -128,10 +132,12 @@ namespace Terminal.Test.Application { }); GLib.Test.add_func ("/application/cli/working-directory", () => { +stdout.printf ("# Starting /application/cli/working-directory\n"); unowned var working_directory = GLib.Test.get_dir (GLib.Test.FileType.DIST); var cwd = Environment.get_current_dir (); cli ({ "io.elementary.terminal", "-w", working_directory }, (dict) => { +stdout.printf ("# Callback for cli 4\n"); assert_false ("working-dir" in dict); var current_directory = Environment.get_current_dir (); assert_cmpstr (current_directory, CompareOperator.EQ, working_directory); @@ -142,7 +148,9 @@ namespace Terminal.Test.Application { // primary command line: first instance from terminal. any instance from dbus. GLib.Test.add_func ("/application/command-line/new-tab", () => { +stdout.printf ("# Starting /application/command-line/new-tab\n"); option ("{'new-tab':}", "@a{sv} {}", () => { +stdout.printf ("# Callback for option 1\n"); unowned var window = (MainWindow) application.active_window; assert_nonnull (window); var n_tabs = (int) window.notebook.n_pages; @@ -150,6 +158,7 @@ namespace Terminal.Test.Application { }); option ("{'new-tab':}", "@a{sv} {}", () => { +stdout.printf ("# Callback for option 2\n"); unowned var window = (MainWindow) application.active_window; assert_nonnull (window); var n_tabs = (int) window.notebook.n_pages; @@ -158,22 +167,27 @@ namespace Terminal.Test.Application { }); GLib.Test.add_func ("/application/command-line/new-window", () => { +stdout.printf ("# Starting /application/command-line/new-window\n"); option ("{'new-window':}", "@a{sv} {}", () => { +stdout.printf ("# Callback for option 3\n"); var n_windows = (int) application.get_windows ().length (); assert_cmpint (n_windows, CompareOperator.EQ, 2); }); option ("{'new-window':}", "@a{sv} {}", () => { +stdout.printf ("# Callback for option 4\n"); var n_windows = (int) application.get_windows ().length (); assert_cmpint (n_windows, CompareOperator.EQ, 1); }); }); GLib.Test.add_func ("/application/command-line/execute", () => { +stdout.printf ("# Starting /application/command-line/execute\n"); string[] execute = { "true", "echo test", "echo -e te\\tst", "false" }; //valid option ("{'execute':<[b'%s']>}".printf (string.joinv ("',b'", execute)), "@a{sv} {}", () => { +stdout.printf ("# Callback for option 5\n"); unowned var window = (MainWindow) application.active_window; assert_nonnull (window); var n_tabs = (int) window.notebook.n_pages; @@ -182,6 +196,7 @@ namespace Terminal.Test.Application { // invalid option ("{'execute':<[b'',b'',b'']>}", "@a{sv} {}", () => { +stdout.printf ("# Callback for option 6\n"); unowned var window = (MainWindow) application.active_window; assert_nonnull (window); var n_tabs = (int) window.notebook.n_pages; @@ -193,9 +208,11 @@ namespace Terminal.Test.Application { GLib.Test.add_func ("/application/command-line/commandline", () => GLib.Test.skip ()); GLib.Test.add_func ("/application/command-line/platform-data/cwd", () => { +stdout.printf ("# Starting //application/command-line/platform-data/cwd\n"); unowned var working_directory = GLib.Test.get_dir (GLib.Test.FileType.DIST); option ("{'new-tab':}", "{'cwd':}".printf (working_directory), () => { +stdout.printf ("# Callback for option 7\n"); unowned var window = (MainWindow) application.active_window; assert_nonnull (window); var terminal_directory = window.current_terminal.get_shell_location (); @@ -205,7 +222,9 @@ namespace Terminal.Test.Application { // actions GLib.Test.add_func ("/application/action/new-window", () => { +stdout.printf ("# Starting /application/action/new-window\n"); action ("new-window", null, () => { +stdout.printf ("# Callback for action 1\n"); // include the extra window from terminal launching var n_windows = (int) application.get_windows ().length (); assert_cmpint (n_windows, CompareOperator.EQ, 2); @@ -213,7 +232,9 @@ namespace Terminal.Test.Application { }); GLib.Test.add_func ("/application/action/quit", () => { +stdout.printf ("# Starting /application/action/quit\n"); action ("quit", null, () => { +stdout.printf ("# Callback for action 2\n"); assert_null (application.active_window); }); });