From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?B?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: Re: [PATCH v4 7/7] t/README: Document the do's and don'ts of tests Date: Tue, 6 Jul 2010 13:02:22 +0000 Message-ID: References: <1278082789-19872-1-git-send-email-avarab@gmail.com> <1278082789-19872-8-git-send-email-avarab@gmail.com> <7vaaq58hhb.fsf@alter.siamese.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Junio C Hamano , git@vger.kernel.org, Jeff King To: Jakub Narebski X-From: git-owner@vger.kernel.org Tue Jul 06 15:02:31 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 1OW7nC-0002Fu-Qj for gcvg-git-2@lo.gmane.org; Tue, 06 Jul 2010 15:02:31 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757074Ab0GFNCY convert rfc822-to-quoted-printable (ORCPT ); Tue, 6 Jul 2010 09:02:24 -0400 Received: from mail-iw0-f174.google.com ([209.85.214.174]:46654 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756860Ab0GFNCX convert rfc822-to-8bit (ORCPT ); Tue, 6 Jul 2010 09:02:23 -0400 Received: by iwn7 with SMTP id 7so6621889iwn.19 for ; Tue, 06 Jul 2010 06:02:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=pmkucU5vb6iP7kHh079RMguarDVBnf/C0IF+GKm2HLk=; b=vA1l3LLDFEul5cEGw3W/KmhCfSCuYIS/xGXsyxjhSJRillIJ2b5W2wvQZann5IOEQY 50LuN/4bS4iZ6s7jnjytS1ArHUt4H5FWd7UBCC8KAr8RHW6PFCb+0DhknD4LG0mipGCD sAZIJlzyIKQFNDSkmFeToAgylNtmlJgg241wI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=uhpbLTY9AkSnfLlm7lpbvwapg0k9ZdRyWJgoyKSyVER7qmucbCr85S0/tJTA1TecuR 7evmkP+qitu16+tmevZ7Ugf7FkiQMMmfrwjTCOrb9Cvh/u0STmJmP29gHtu6FviLHKzW u8UrC0ulLkncSG47vOhD3qqAsut/gq1yZmSek= Received: by 10.231.183.19 with SMTP id ce19mr4659374ibb.35.1278421342714; Tue, 06 Jul 2010 06:02:22 -0700 (PDT) Received: by 10.231.166.79 with HTTP; Tue, 6 Jul 2010 06:02:22 -0700 (PDT) In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: On Tue, Jul 6, 2010 at 08:35, Jakub Narebski wrote: > Junio C Hamano writes: >> =C3=86var Arnfj=C3=B6r=C3=B0 Bjarmason writes: >> >> > +Do: >> > + >> > + - Put as much code as possible inside test_expect_success and ot= her >> > + =C2=A0 assertions. >> > + >> > + =C2=A0 Even code that isn't a test per se, but merely some setup= code >> > + =C2=A0 should be inside a test assertion if at all possible. Tes= t scripts >> > + =C2=A0 should only have trivial code outside of their assertions= =2E >> >> Let's make it even stronger; "should only have trivial" -> "shouldn'= t have >> any ... unless there is a good reason." > > I think that the only thing that can and *should* be put outside > test_expect_* is creating helper file: test vectors ('expect' files), > configuration files, files that are to be arguments to commands, etc. > Is it covered by "there is a good reason"? =C2=A0Isn't it too severe? Personally I'd put `.. >expect && .. >actual && test_cmp' inside test_expect_* too if they're only going to be used by that test, but outside them at the top of the file if they're files that are used by multiple tests for the duration of the test run. > There probably should be description when to put creating such files > in test script, and when to put them as pre-made files in tXXXX/ > subdirectory (non US-ASCII is one reason to put it as pre-made file). I don't know which one would be preferrable. We have a lot of things in t/t*/* that could be generated by a test, and vice-versa.