From patchwork Tue Jul 7 06:04:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11647679 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FC3313BD for ; Tue, 7 Jul 2020 06:05:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3679620758 for ; Tue, 7 Jul 2020 06:05:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KsMgcEXh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728215AbgGGGFJ (ORCPT ); Tue, 7 Jul 2020 02:05:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728204AbgGGGFH (ORCPT ); Tue, 7 Jul 2020 02:05:07 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EEC0C061794 for ; Mon, 6 Jul 2020 23:05:07 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id q198so37150395qka.2 for ; Mon, 06 Jul 2020 23:05:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S5HXV90BTLysKS2/1O+EbNfR5SQj4JWEsCACgTL/Vcw=; b=KsMgcEXhKRMhP2aXh+JBhar/Q3kz6y/kaH4E3njhm7nlZS4FUGpt0jzFqETJ9EXPVZ 1d+0igs28g3vWh3VTbt3lb1rh8FQTWPjrDuyDC0BBRuaHcmN5fOJnahT3Hv+l1oVCOr2 H7UpNwlDiHLrt9UD6WOokVNkL48GklnwDktE4ToKhUFl2fCyezcyLupai9gESgd657bN YylkN4TE/RnAohGhwDoBgfa9YgwimsPlK+eGjDbwLXuivpAnCUvFNctbdUUWJAHr9Bpq BaSv3lNcTlF2DqbX3FRHAc1DI87GqkWHL76Tw7MOwUuaVnBICcDRFQdyOsYAOftx//Q2 3stw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S5HXV90BTLysKS2/1O+EbNfR5SQj4JWEsCACgTL/Vcw=; b=hSvq1Fm0RuFqJiQI8FqRojnWXjF0yUBWxDGyUlueDvJqgD9W8jbC4EERO2AiA94xve 1AObE+q1l6aISyBSw0Q1v24p/3x+DWi3jIvL5jRNfz1SsIVKVbeaJeY2SRAcw0bFoSeR sozK+SNJmRwAOj6oF5Bm8VFLv0lRNtcSwjQyJj5FYQqYkH/MxlDDPttvej76BGqfVa6c WaPRKlvNHqvEU/eL/91PXwWSvXAlcJUoPOiJmh9MBzmdiyD6yscEL9ypdCbmsIC+ZiOY VjPUKtmU3RwDe3RH2K272xDtXfbue5cXBV/yCVr+sha+ehxbgZcn7zRU7tQD8D7UDS+P KZ/w== X-Gm-Message-State: AOAM533a0lwbHm3EITvg80UehjuxHnI8DGMPExam7qA+A4rbZir2kiVL 8OtBVLXHdF+/KV3gwgwxckUMSmu5DxM= X-Google-Smtp-Source: ABdhPJy/YXbpf2XuBsqaPWv2M7x9YJxifCb1k4z50ucTy2ZqATycVLfRbIGyPirAL8tNU1ztXZ8vTg== X-Received: by 2002:a37:aa05:: with SMTP id t5mr50178353qke.451.1594101906181; Mon, 06 Jul 2020 23:05:06 -0700 (PDT) Received: from archbookpro.phub.net.cable.rogers.com (CPEc05627352ede-CM185933998587.cpe.net.cable.rogers.com. [174.112.146.193]) by smtp.gmail.com with ESMTPSA id k197sm23446778qke.133.2020.07.06.23.05.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2020 23:05:05 -0700 (PDT) From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Junio C Hamano Subject: [RESEND PATCH v2 3/5] t7107: don't use test_must_fail() Date: Tue, 7 Jul 2020 02:04:36 -0400 Message-Id: X-Mailer: git-send-email 2.27.0.383.g050319c2ae 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 We had a `test_must_fail verify_expect`. However, the git command in verify_expect() was not expected to fail; the test_cmp() was the failing command. Be more precise about testing failure by accepting an optional first argument of '!' which causes the result of the file comparison to be negated. Signed-off-by: Denton Liu --- t/t7107-reset-pathspec-file.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/t/t7107-reset-pathspec-file.sh b/t/t7107-reset-pathspec-file.sh index cad3a9de9e..15ccb14f7e 100755 --- a/t/t7107-reset-pathspec-file.sh +++ b/t/t7107-reset-pathspec-file.sh @@ -22,7 +22,12 @@ restore_checkpoint () { verify_expect () { git status --porcelain -- fileA.t fileB.t fileC.t fileD.t >actual && - test_cmp expect actual + if test "x$1" = 'x!' + then + ! test_cmp expect actual + else + test_cmp expect actual + fi } test_expect_success '--pathspec-from-file from stdin' ' @@ -131,7 +136,7 @@ test_expect_success 'quotes not compatible with --pathspec-file-nul' ' cat >expect <<-\EOF && D fileA.t EOF - test_must_fail verify_expect + verify_expect ! ' test_expect_success 'only touches what was listed' '