From mboxrd@z Thu Jan 1 00:00:00 1970 From: Will Palmer Subject: [PATCHv2 1/2] add basic tests for merge-tree Date: Sun, 11 Jul 2010 14:16:54 +0100 Message-ID: <1278854215-9022-2-git-send-email-wmpalmer@gmail.com> References: <1278854215-9022-1-git-send-email-wmpalmer@gmail.com> Cc: wmpalmer@gmail.com, gitster@pobox.com To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Sun Jul 11 15:17:35 2010 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OXwPW-0004JH-Vm for gcvg-git-2@lo.gmane.org; Sun, 11 Jul 2010 15:17:35 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754145Ab0GKNRS (ORCPT ); Sun, 11 Jul 2010 09:17:18 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:55142 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752997Ab0GKNRG (ORCPT ); Sun, 11 Jul 2010 09:17:06 -0400 Received: by wyf23 with SMTP id 23so2744595wyf.19 for ; Sun, 11 Jul 2010 06:17:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=yzqkQ/P/8VzTRAgpdNYoV1w0z0LP1BkAOlDg7g+0axA=; b=wL8ggJlXPxeb+kCa8C/yOlxy7hXL5NFiy75/o5TtKDcDlWdeT0nml+tyyG1Aj12jW2 3sYKKgHfLBMnNxe457cdpydRzcgN+Fonwhw4CSIO4KAltwDlDwaJrRh1IpEyvvc+CONs 9oRz0jD+hZkxVtDq2rzvSNDm2F3CH4tjluVlY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=ttlIMWl8G/sTD/7U/5f7mgfPJz2gHEDe1TA2X37+8kDgRyQcTW6N1Xeu3olcudkhOc Mp1ml1nHzPbxAcRMZjvXdS6TpiBMVNBZIC/lfEA3nqg80fJSB9YWfIpO90HzAfnsew9y JWb6g+fZZ5Sy5ym8YnYG2Kbnx5TZDSe0iPW9o= Received: by 10.227.99.79 with SMTP id t15mr2645406wbn.209.1278854223230; Sun, 11 Jul 2010 06:17:03 -0700 (PDT) Received: from localhost.localdomain (5acc3a9a.bb.sky.com [90.204.58.154]) by mx.google.com with ESMTPS id a27sm22521966wbe.12.2010.07.11.06.17.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 11 Jul 2010 06:17:02 -0700 (PDT) X-Mailer: git-send-email 1.7.1.703.g42c01 In-Reply-To: <1278854215-9022-1-git-send-email-wmpalmer@gmail.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: merge-tree had no test cases, so here we add some very basic tests for it, including some known-breakages. Signed-off-by: Will Palmer --- t/t4300-merge-tree.sh | 277 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 277 insertions(+), 0 deletions(-) create mode 100755 t/t4300-merge-tree.sh diff --git a/t/t4300-merge-tree.sh b/t/t4300-merge-tree.sh new file mode 100755 index 0000000..b2ae3a1 --- /dev/null +++ b/t/t4300-merge-tree.sh @@ -0,0 +1,277 @@ +#!/bin/sh +# +# Copyright (c) 2010 Will Palmer +# + +test_description='git merge-tree' +. ./test-lib.sh + +test_expect_success setup ' + test_commit "initial" "initial-file" "initial" +' + +test_expect_'file add A, !B' ' + cat >expected <actual && + test_cmp expected actual +' + +test_expect_failure 'file add !A, B' ' + cat >expected <actual && + test_cmp expected actual +' + +test_expect_success 'file add A, B (same)' ' + cat >expected <actual && + test_cmp expected actual +' + +test_expect_success 'file add A, B (different)' ' + cat >expected <>>>>>> .their +EXPECTED + + git reset --hard initial + test_commit "add-a-b-diff-A" "ONE" "AAA" + + git reset --hard initial + test_commit "add-a-b-diff-B" "ONE" "BBB" + + git merge-tree initial add-a-b-diff-A add-a-b-diff-B >actual && + test_cmp expected actual +' + +test_expect_success 'file change A, !B' ' + cat >expected <actual && + test_cmp expected actual +' + +test_expect_success 'file change !A, B' ' + cat >expected <actual && + test_cmp expected actual +' + +test_expect_success 'file change A, B (same)' ' + cat >expected <actual && + test_cmp expected actual +' + +test_expect_success 'file change A, B (different)' ' + cat >expected <>>>>>> .their +EXPECTED + + git reset --hard initial + test_commit "change-a-b-diff-A" "initial-file" "AAA" + + git reset --hard initial + test_commit "change-a-b-diff-B" "initial-file" "BBB" + + git merge-tree initial change-a-b-diff-A change-a-b-diff-B >actual && + test_cmp expected actual +' + +test_expect_success 'file change A, B (mixed)' ' + cat >expected <>>>>>> .their + AAA + AAA + AAA +EXPECTED + + git reset --hard initial + test_commit "change-a-b-mix-base" "ONE" " +AAA +AAA +AAA +AAA +AAA +AAA +AAA +AAA +AAA +AAA +AAA +AAA +AAA +AAA +AAA" + + test_commit "change-a-b-mix-A" "ONE" \ + "$(sed -e "1{s/AAA/BBB/;}" -e "10{s/AAA/BBB/;}" actual && + test_cmp expected actual +' + +test_expect_success 'file remove A, !B' ' + cat >expected <actual && + test_cmp expected actual +' + +test_expect_failure 'file remove !A, B' ' + cat >expected <actual && + test_cmp expected actual +' + +test_expect_failure 'file change A, remove B' ' + cat >expected <actual && + test_cmp expected actual +' + +test_expect_success 'file remove A, change B' ' + cat >expected <actual && + test_cmp expected actual +' + +test_done -- 1.7.1.703.g42c01