From: Jeff Hostetler <jeffh...@microsoft.com>

Test running a command with a fake pager and verify that a child_summary
is generated.

Signed-off-by: Jeff Hostetler <jeffh...@microsoft.com>
---
 t/t0420-structured-logging.sh | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/t/t0420-structured-logging.sh b/t/t0420-structured-logging.sh
index 4ac404d..69f811a 100755
--- a/t/t0420-structured-logging.sh
+++ b/t/t0420-structured-logging.sh
@@ -260,4 +260,34 @@ test_expect_success PERLJSON 'verify child start/end 
events during clone' '
        grep "row\[1\]\.detail\.data\.child_exit_code 0" <parsed_detail
 '
 
+. "$TEST_DIRECTORY"/lib-pager.sh
+. "$TEST_DIRECTORY"/lib-terminal.sh
+
+test_expect_success 'setup fake pager to test interactive' '
+       test_when_finished "rm \"$LOGFILE\" " &&
+       sane_unset GIT_PAGER GIT_PAGER_IN_USE &&
+       test_unconfig core.pager &&
+
+       PAGER="cat >paginated.out" &&
+       export PAGER &&
+
+       test_commit initial
+'
+
+test_expect_success TTY 'verify fake pager detected and process marked 
interactive' '
+       test_when_finished "rm \"$LOGFILE\" event_exit" &&
+       rm -f paginated.out &&
+       rm -f "$LOGFILE" &&
+
+       test_terminal git log &&
+       test -e paginated.out &&
+
+       grep -f key_cmd_exit "$LOGFILE" >event_exit &&
+
+       perl "$TEST_DIRECTORY"/t0420/parse_json.perl <event_exit >parsed_exit &&
+
+       grep "row\[0\]\.child_summary\.pager\.count 1" <parsed_exit
+'
+
+
 test_done
-- 
2.9.3

Reply via email to