Download raw body.
regress for new got log -d
On Sat, Jan 07, 2023 at 11:03:53PM +1100, Mark Jamsek wrote:
> As per subject, add a test for 'got log -d'
ok
> -----------------------------------------------
> commit fd0a7944d027ac4ef47985a8e10ae91b07ef6ab9 (main)
> from: Mark Jamsek <mark@jamsek.dev>
> date: Sat Jan 7 12:00:41 2023 UTC
>
> add regress for new got log -d switch
>
> M regress/cmdline/log.sh | 50+ 0-
>
> 1 file changed, 50 insertions(+), 0 deletions(-)
>
> diff ddc1bfe037dd99b2df4bcb955f8383d2c0f2a770 fd0a7944d027ac4ef47985a8e10ae91b07ef6ab9
> commit - ddc1bfe037dd99b2df4bcb955f8383d2c0f2a770
> commit + fd0a7944d027ac4ef47985a8e10ae91b07ef6ab9
> blob - 70b885ea4ca9f69d8efec236194dd51d5935741e
> blob + 36c40d891f80c07c830e944e477fd259958d981e
> --- regress/cmdline/log.sh
> +++ regress/cmdline/log.sh
> @@ -849,6 +849,55 @@ test_parseargs "$@"
> test_done "$testroot" "$ret"
> }
>
> +test_log_diffstat() {
> + local testroot=`test_init log_diffstat`
> +
> + got checkout $testroot/repo $testroot/wt > /dev/null
> + ret=$?
> + if [ $ret -ne 0 ]; then
> + test_done "$testroot" "$ret"
> + return 1
> + fi
> +
> + echo "modified\nalpha." > $testroot/wt/alpha
> + (cd $testroot/wt && got commit -m 'log_diffstat mod file' > /dev/null)
> +
> + (cd $testroot/wt && got rm beta >/dev/null)
> + (cd $testroot/wt && chmod +x epsilon/zeta >/dev/null)
> + (cd $testroot/wt && got commit -m 'log_diffstat rm file' > /dev/null)
> +
> + echo "new file" > $testroot/wt/new
> + (cd $testroot/wt && got add new >/dev/null)
> + (cd $testroot/wt && got commit -m 'log_diffstat add file' > /dev/null)
> +
> + (cd $testroot/wt && got log -d | grep -A2 '^ [MDmA]' | sed '/^--/d' > \
> + $testroot/stdout)
> +
> + echo " A new | 1+ 0-" > $testroot/stdout.expected
> + echo "\n1 file changed, 1 insertions(+), 0 deletions(-)" >> \
> + $testroot/stdout.expected
> + echo " D beta | 0+ 1-" >> $testroot/stdout.expected
> + echo " m epsilon/zeta | 0+ 0-" >> $testroot/stdout.expected
> + echo "\n2 files changed, 0 insertions(+), 1 deletions(-)" >> \
> + $testroot/stdout.expected
> + echo " M alpha | 2+ 1-" >> $testroot/stdout.expected
> + echo "\n1 file changed, 2 insertions(+), 1 deletions(-)" >> \
> + $testroot/stdout.expected
> + echo " A alpha | 1+ 0-" >> $testroot/stdout.expected
> + echo " A beta | 1+ 0-" >> $testroot/stdout.expected
> + echo " A epsilon/zeta | 1+ 0-" >> $testroot/stdout.expected
> + echo " A gamma/delta | 1+ 0-" >> $testroot/stdout.expected
> + echo "\n4 files changed, 4 insertions(+), 0 deletions(-)" >> \
> + $testroot/stdout.expected
> +
> + cmp -s $testroot/stdout.expected $testroot/stdout
> + ret=$?
> + if [ $ret -ne 0 ]; then
> + diff -u $testroot/stdout.expected $testroot/stdout
> + fi
> + test_done "$testroot" "$ret"
> +}
> +
> test_parseargs "$@"
> run_test test_log_in_repo
> run_test test_log_in_bare_repo
> @@ -864,3 +913,4 @@ run_test test_log_submodule
> run_test test_log_in_worktree_different_repo
> run_test test_log_changed_paths
> run_test test_log_submodule
> +run_test test_log_diffstat
>
> --
> Mark Jamsek <fnc.bsdbox.org>
> GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68
regress for new got log -d