commit 67c65ed764e7542fc784be76cd535c4073c813c3 from: Tracey Emery date: Tue Sep 14 15:47:30 2021 UTC add tests for checkout -q, update -q, and status -S. ok stsp commit - 788d4a19ed0ddf9df069f9a6d5a8ecd9ebf932ee commit + 67c65ed764e7542fc784be76cd535c4073c813c3 blob - f9066950a272a65b3095aa0b65af01fccd329c41 blob + 7e75429e4fe31fb4f4ec10afbd607d1b71f67721 --- regress/cmdline/checkout.sh +++ regress/cmdline/checkout.sh @@ -812,7 +812,44 @@ test_checkout_repo_with_unknown_extension() { ret="$?" if [ "$ret" != "0" ]; then diff -u $testroot/stderr.expected $testroot/stderr + fi + test_done "$testroot" "$ret" +} + +test_checkout_quiet() { + local testroot=`test_init checkout_quiet` + + echo -n "Checked out refs/heads/master: " >> $testroot/stdout.expected + git_show_head $testroot/repo >> $testroot/stdout.expected + echo "\nNow shut up and hack" >> $testroot/stdout.expected + + got checkout -q $testroot/repo $testroot/wt > $testroot/stdout + ret="$?" + if [ "$ret" != "0" ]; then + test_done "$testroot" "$ret" + return 1 + fi + + cmp -s $testroot/stdout.expected $testroot/stdout + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 fi + + echo "alpha" > $testroot/content.expected + echo "beta" >> $testroot/content.expected + echo "zeta" >> $testroot/content.expected + echo "delta" >> $testroot/content.expected + cat $testroot/wt/alpha $testroot/wt/beta $testroot/wt/epsilon/zeta \ + $testroot/wt/gamma/delta > $testroot/content + + cmp -s $testroot/content.expected $testroot/content + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/content.expected $testroot/content + fi test_done "$testroot" "$ret" } @@ -829,3 +866,4 @@ run_test test_checkout_into_nonempty_dir run_test test_checkout_symlink run_test test_checkout_symlink_relative_wtpath run_test test_checkout_repo_with_unknown_extension +run_test test_checkout_quiet blob - 8c6c24e701901e9c2ad8922e593794b9365ff248 blob + 115ad4e02c4a245334f6fd2b1c8db185b26e2046 --- regress/cmdline/status.sh +++ regress/cmdline/status.sh @@ -792,6 +792,76 @@ test_status_status_code() { echo 'M alpha' > $testroot/stdout.expected echo 'MA new' >> $testroot/stdout.expected (cd $testroot/wt && got status -s M > $testroot/stdout) + cmp -s $testroot/stdout.expected $testroot/stdout + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + + test_done "$testroot" "$ret" +} + +test_status_suppress() { + local testroot=`test_init status_suppress` + + got checkout $testroot/repo $testroot/wt > /dev/null + ret="$?" + if [ "$ret" != "0" ]; then + test_done "$testroot" "$ret" + return 1 + fi + + echo "modified alpha" > $testroot/wt/alpha + (cd $testroot/wt && got rm beta >/dev/null) + echo "unversioned file" > $testroot/wt/foo + rm $testroot/wt/epsilon/zeta + touch $testroot/wt/beta + echo "new file" > $testroot/wt/new + (cd $testroot/wt && got add new >/dev/null) + + (cd $testroot/wt && got status -S xDM \ + > $testroot/stdout 2> $testroot/stderr) + ret="$?" + if [ "$ret" = "0" ]; then + echo "status succeeded unexpectedly" >&2 + test_done "$testroot" "1" + return 1 + fi + + echo "got: invalid status code 'x'" > $testroot/stderr.expected + cmp -s $testroot/stderr.expected $testroot/stderr + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/stderr.expected $testroot/stderr + test_done "$testroot" "$ret" + return 1 + fi + + echo 'M alpha' > $testroot/stdout.expected + (cd $testroot/wt && got status -S D?A\! > $testroot/stdout) + cmp -s $testroot/stdout.expected $testroot/stdout + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + + echo 'D beta' > $testroot/stdout.expected + (cd $testroot/wt && got status -S M?A\! > $testroot/stdout) + cmp -s $testroot/stdout.expected $testroot/stdout + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + + echo '! epsilon/zeta' > $testroot/stdout.expected + echo '? foo' >> $testroot/stdout.expected + (cd $testroot/wt && got status -S MDA > $testroot/stdout) cmp -s $testroot/stdout.expected $testroot/stdout ret="$?" if [ "$ret" != "0" ]; then @@ -800,6 +870,63 @@ test_status_status_code() { return 1 fi + echo 'A new' > $testroot/stdout.expected + (cd $testroot/wt && got status -S MD?\! > $testroot/stdout) + cmp -s $testroot/stdout.expected $testroot/stdout + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + + (cd $testroot/wt && got stage new > $testroot/stdout) + + echo ' A new' > $testroot/stdout.expected + (cd $testroot/wt && got status -S MD?\! > $testroot/stdout) + cmp -s $testroot/stdout.expected $testroot/stdout + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + + echo 'changed file new' > $testroot/wt/new + + echo 'M alpha' > $testroot/stdout.expected + echo 'MA new' >> $testroot/stdout.expected + (cd $testroot/wt && got status -S D?\! > $testroot/stdout) + cmp -s $testroot/stdout.expected $testroot/stdout + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + + echo 'M alpha' > $testroot/stdout.expected + (cd $testroot/wt && got status -S AD?\! > $testroot/stdout) + cmp -s $testroot/stdout.expected $testroot/stdout + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + + rm $testroot/stdout.expected + touch $testroot/stdout.expected + + (cd $testroot/wt && got status -S MD?\! > $testroot/stdout) + cmp -s $testroot/stdout.expected $testroot/stdout + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + test_done "$testroot" "$ret" } @@ -873,4 +1000,5 @@ run_test test_status_many_paths run_test test_status_cvsignore run_test test_status_gitignore run_test test_status_status_code +run_test test_status_suppress run_test test_status_empty_file blob - b75e01faf9766a5bd715ecc25bc1373dc6f135a1 blob + 978c9327b52f6cef6b7132cbec888901629b735c --- regress/cmdline/update.sh +++ regress/cmdline/update.sh @@ -2678,8 +2678,45 @@ test_update_file_skipped_due_to_obstruction() { fi test_done "$testroot" "$ret" } + +test_update_quiet() { + local testroot=`test_init update_quiet` + + got checkout $testroot/repo $testroot/wt > /dev/null + ret="$?" + if [ "$ret" != "0" ]; then + test_done "$testroot" "$ret" + return 1 + fi + + echo "modified alpha" > $testroot/repo/alpha + git_commit $testroot/repo -m "modified alpha" + + echo -n "Updated to commit " >> $testroot/stdout.expected + git_show_head $testroot/repo >> $testroot/stdout.expected + echo >> $testroot/stdout.expected + + (cd $testroot/wt && got update -q > $testroot/stdout) + + cmp -s $testroot/stdout.expected $testroot/stdout + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + echo "modified alpha" > $testroot/content.expected + cat $testroot/wt/alpha > $testroot/content + cmp -s $testroot/content.expected $testroot/content + ret="$?" + if [ "$ret" != "0" ]; then + diff -u $testroot/content.expected $testroot/content + fi + test_done "$testroot" "$ret" +} + test_parseargs "$@" run_test test_update_basic run_test test_update_adds_file @@ -2722,3 +2759,4 @@ run_test test_update_symlink_conflicts run_test test_update_single_file run_test test_update_file_skipped_due_to_conflict run_test test_update_file_skipped_due_to_obstruction +run_test test_update_quiet