From patchwork Tue Sep 25 22:33:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul-Sebastian Ungureanu X-Patchwork-Id: 10614903 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E95F416B1 for ; Tue, 25 Sep 2018 22:34:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBFA9298BF for ; Tue, 25 Sep 2018 22:34:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D06EF2AD37; Tue, 25 Sep 2018 22:34:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C4F9298BF for ; Tue, 25 Sep 2018 22:34:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726372AbeIZEoN (ORCPT ); Wed, 26 Sep 2018 00:44:13 -0400 Received: from mail-ed1-f48.google.com ([209.85.208.48]:39854 "EHLO mail-ed1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726319AbeIZEoN (ORCPT ); Wed, 26 Sep 2018 00:44:13 -0400 Received: by mail-ed1-f48.google.com with SMTP id h4-v6so185083edi.6 for ; Tue, 25 Sep 2018 15:34:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=0hiLFsi6N+zD69VmUURWdwsROxwb/Narz5T/ytUhcv4=; b=EhFOG7Wti0zEL6zDkrEhqwpLPwt55xueqe82woN9YTDCoKXtRjIoIfNoDbeQFTq1xk IPQ9AowoWeuJslO2NUn0bnWqE+AjcL1BJLZDi2lJOEQSUiqqfB4ijYbZUawc0PjL9pXN 7TQHKo+nx/tBQrP2aJ8j3kPUtW/6lgs/vHwrHa7UDep9LMSZuogt+7ElQDD3g3VU1pf5 jmmbBLe14iIzqmboQgYZbGA09D4ot4DhJz9E2hS08AOKpF/SvR3ujrEZX9WIdz5uyGt+ rrB5wXe+CaFTvpE0q0NsNx2EfbT89ea+HIASPmCkCw3poGYN9aJBgJcQwWzJEP3tUULI dzrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0hiLFsi6N+zD69VmUURWdwsROxwb/Narz5T/ytUhcv4=; b=ZtKGT+p6T/lZM6puEJhxSzFkGvLvO1PBuJENLKDA7lKeOKqTqDIOX5+QNVLvOpea23 k33aUMdNx9V5mGMXjSx1Ayp1+58EHFsYnBG1MIgxX/ftQ64w9VGGruZao+mmtCb66MPf +rCsIMcTM2Nsa0raJ23wi2vJUKiTs9oh7ovLgGPdCIeKmNp8oHmTldGJalQ39A5SLIaZ pjv7DWlg5FBF5LsKAafFKJtqKnSBnuhg0AO2HOBZVHoSNhUYe28nXpF6R0xJZRndrK9Y dN0tgKpzAjo+SSSrxA/Sm7iWghdxJ8VYHPJOOqaQfTamJRMW7Ce5aeed5JjhPJ77aueL 5vmA== X-Gm-Message-State: ABuFfoh58XE9K0ZGXKPIvYyOTVm7RjtCE2UNwdTqP8ICxtFQvLp9rA6Z /wIWByHqotYR5BQ4skkE5XozWeea X-Google-Smtp-Source: ACcGV61LNRqKN4fGEG+CWsJ0rF345RZo3u4wRZgDp3W7PWRh7WlqK1EuvR4yiW3Kn7UkUxPKZV+4Zg== X-Received: by 2002:a50:d1c7:: with SMTP id i7-v6mr4727129edg.169.1537914866595; Tue, 25 Sep 2018 15:34:26 -0700 (PDT) Received: from localhost.localdomain ([92.55.154.13]) by smtp.gmail.com with ESMTPSA id o37-v6sm33553edo.71.2018.09.25.15.34.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Sep 2018 15:34:25 -0700 (PDT) From: Paul-Sebastian Ungureanu To: git@vger.kernel.org Subject: [GSoC][PATCH v9 05/21] stash: add tests for `git stash show` config Date: Wed, 26 Sep 2018 01:33:19 +0300 Message-Id: X-Mailer: git-send-email 2.19.0.rc0.23.g1fb9f40d88.dirty In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This commit introduces tests for `git stash show` config. It tests all the cases where `stash.showStat` and `stash.showPatch` are unset or set to true / false. Signed-off-by: Paul-Sebastian Ungureanu --- t/t3907-stash-show-config.sh | 83 ++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100755 t/t3907-stash-show-config.sh diff --git a/t/t3907-stash-show-config.sh b/t/t3907-stash-show-config.sh new file mode 100755 index 0000000000..10914bba7b --- /dev/null +++ b/t/t3907-stash-show-config.sh @@ -0,0 +1,83 @@ +#!/bin/sh + +test_description='Test git stash show configuration.' + +. ./test-lib.sh + +test_expect_success 'setup' ' + test_commit file +' + +# takes three parameters: +# 1. the stash.showStat value (or "") +# 2. the stash.showPatch value (or "") +# 3. the diff options of the expected output (or nothing for no output) +test_stat_and_patch () { + if test "" = "$1" + then + test_unconfig stash.showStat + else + test_config stash.showStat "$1" + fi && + + if test "" = "$2" + then + test_unconfig stash.showPatch + else + test_config stash.showPatch "$2" + fi && + + shift 2 && + echo 2 >file.t && + if test $# != 0 + then + git diff "$@" >expect + fi && + git stash && + git stash show >actual && + + if test $# = 0 + then + test_must_be_empty actual + else + test_cmp expect actual + fi +} + +test_expect_success 'showStat unset showPatch unset' ' + test_stat_and_patch "" "" --stat +' + +test_expect_success 'showStat unset showPatch false' ' + test_stat_and_patch "" false --stat +' + +test_expect_success 'showStat unset showPatch true' ' + test_stat_and_patch "" true --stat -p +' + +test_expect_success 'showStat false showPatch unset' ' + test_stat_and_patch false "" +' + +test_expect_success 'showStat false showPatch false' ' + test_stat_and_patch false false +' + +test_expect_success 'showStat false showPatch true' ' + test_stat_and_patch false true -p +' + +test_expect_success 'showStat true showPatch unset' ' + test_stat_and_patch true "" --stat +' + +test_expect_success 'showStat true showPatch false' ' + test_stat_and_patch true false --stat +' + +test_expect_success 'showStat true showPatch true' ' + test_stat_and_patch true true --stat -p +' + +test_done