From patchwork Tue Oct 22 10:20:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11204197 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 5D4B31951 for ; Tue, 22 Oct 2019 10:20:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3C1D4218AE for ; Tue, 22 Oct 2019 10:20:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ugCXjhN0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731789AbfJVKUJ (ORCPT ); Tue, 22 Oct 2019 06:20:09 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:44981 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfJVKUI (ORCPT ); Tue, 22 Oct 2019 06:20:08 -0400 Received: by mail-pf1-f193.google.com with SMTP id q21so10348742pfn.11 for ; Tue, 22 Oct 2019 03:20:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=WfTfRLFhXz1RU/LqEDa8JaobLYBGmAz3HY+wZYyQVow=; b=ugCXjhN0yTfUcREmP2IW4rVrFzN6wu049rYkFEJN1yzZuusA48oWz0A53eYcmJz2zG Jg5Xsb6VtY3v+MJuZZTQ8ruIZoTCJEws7OvhLOrcMzzsUIQCCYSspOWDLK3lNBWH9kuB kMFM06RKs5RDjjXVn2P8UKiWx3bwoA2UMU2uAIKt8vE8JzSmQbXmGM/iM5xdELzhEAFE t9VH0MW33ctgkw7CsFym1Lh+m/NAlycdjkMhnmtjcubsZaCryBDA2Loxg5CTj+GzQzyv 5amYcNSW9CSdeiKKJW3F7eDqLFPh0ZbrbPe8Rco510mbGHUF0kBt7KfsjsZjA8L00ruL LEUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WfTfRLFhXz1RU/LqEDa8JaobLYBGmAz3HY+wZYyQVow=; b=GhX6cyp0oK1guzdSJVsEMc1fshxyZpHTTgqohvhmLaecSEjDWgP4IvF24hFHWHguR7 kSs9GO0Ml7OiORhEQbLelbcepHOp/gn1REsmPrGU72bgUbM1/Sbf8iyW8unkvKobOfq3 EF2C/pCMTDf+GTcklY5zRN9c4la/gOPHMea+l7TRWO8gGpqg3eJp0lL6zkE6ZcQxn/IO 8c/Lya6bN5T06oN2qabYrs6oD9xfnM/IWklD8bqYt1CmCT7T2EnLJMxfm+nxHFlwXC/N RpH3LQ6fj1F5bsYpv9fax5iIo4JkzipenWH5Wbtsro2YqrWvozrI3yoxhx93uhqhBQo6 ZecA== X-Gm-Message-State: APjAAAXbWEv/HGZmfHdyokt7tfZsR+LBZzdmwMMYHbR78Ajp6Jp4sR8k +ipfNvKIGE+nEAnmu6HCetlv8Ibp X-Google-Smtp-Source: APXvYqw/bUxtCmhVWo7JTgw5/pqqCRiJ7QGRbsOZ6epCcoEhCTCpxyAGd2n5ewJrbECHMWtFxsNLsg== X-Received: by 2002:a63:6989:: with SMTP id e131mr2952593pgc.190.1571739607429; Tue, 22 Oct 2019 03:20:07 -0700 (PDT) Received: from generichostname ([2601:646:280:1b30:80db:d816:4d15:ae2a]) by smtp.gmail.com with ESMTPSA id c10sm20679196pfo.49.2019.10.22.03.20.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 03:20:06 -0700 (PDT) Date: Tue, 22 Oct 2019 03:20:05 -0700 From: Denton Liu To: Git Mailing List Cc: Eric Sunshine , Johannes Sixt , SZEDER =?utf-8?b?R8OhYm9y?= Subject: [PATCH v3 05/14] t5520: replace test -f with test-lib functions Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Although `test -f` has the same functionality as test_path_is_file(), in the case where test_path_is_file() fails, we get much better debugging information. Replace `test -f` with test_path_is_file() so that future developers will have a better experience debugging these test cases. Also, in the case of `! test -f`, not only should that path not be a file, it shouldn't exist at all so replace it with test_path_is_missing(). Signed-off-by: Denton Liu --- t/t5520-pull.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 55560ce3cd..004d5884cd 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -39,8 +39,8 @@ test_expect_success 'pulling into void' ' cd cloned && git pull .. ) && - test -f file && - test -f cloned/file && + test_path_is_file file && + test_path_is_file cloned/file && test_cmp file cloned/file ' @@ -50,8 +50,8 @@ test_expect_success 'pulling into void using master:master' ' cd cloned-uho && git pull .. master:master ) && - test -f file && - test -f cloned-uho/file && + test_path_is_file file && + test_path_is_file cloned-uho/file && test_cmp file cloned-uho/file ' @@ -99,7 +99,7 @@ test_expect_success 'pulling into void must not create an octopus' ' ( cd cloned-octopus && test_must_fail git pull .. master master && - ! test -f file + test_path_is_missing file ) '