From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id 7B99B7EE20 for ; Thu, 15 Nov 2012 08:24:48 +0100 (CET) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of marek@xivilization.net) identity=pra; client-ip=178.63.18.39; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="marek@xivilization.net"; x-sender="marek@xivilization.net"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of marek@xivilization.net designates 178.63.18.39 as permitted sender) identity=mailfrom; client-ip=178.63.18.39; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="marek@xivilization.net"; x-sender="marek@xivilization.net"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@coaxial.xivilization.net) identity=helo; client-ip=178.63.18.39; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="marek@xivilization.net"; x-sender="postmaster@coaxial.xivilization.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EADSYpFCyPxIn/2dsb2JhbABEw0qBCIIeAQEEAToGAQE4DwtGVxkVh3AGBKgvhDcBBXWOFQaMMQWDAIMnlX6FbIpYgnA X-IronPort-AV: E=Sophos;i="4.83,254,1352070000"; d="scan'208";a="162527985" Received: from coaxial.xivilization.net ([178.63.18.39]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/AES256-SHA; 15 Nov 2012 08:24:47 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xivilization.net; s=xiv; h=Content-Transfer-Encoding:Content-Type:Mime-Version:References:In-Reply-To:Message-ID:Subject:To:From:Date; bh=BUBH9RCeYL5KxXfGvcwtdVDjAqztRYHSouSnr0iS0KU=; b=FguI/69QNQT6v5C+m9W64wyvU1xHkoyR15V5zeuHeS9y5KSyHsORXOm+Mzq3x4aq1Asru8/n7fR9Byv6JS1xEh2R2NRMFu4205gvwIyIsLxMpqLo+KJFDSoWIuue++tB; Received: from [131.159.197.148] (helo=localhost.localdomain) by coaxial.xivilization.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1TYtod-0000nm-6Y for caml-list@inria.fr; Thu, 15 Nov 2012 08:24:47 +0100 Date: Thu, 15 Nov 2012 08:24:43 +0100 From: Marek Kubica To: caml-list@inria.fr Message-ID: <20121115082443.2af5f758@xivilization.net> In-Reply-To: <1352961419.10207.8.camel@Nokia-N900> References: <20121114124355.7e8ca762@xivilization.net> <50A3ADC1.5090402@gmail.com> <20121114180012.68bf06df@xivilization.net> <1352961419.10207.8.camel@Nokia-N900> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.13; x86_64-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] Preferred layout for new packages Hello Cedric, On Thu, 15 Nov 2012 07:36:59 +0100 Cedric Cellier wrote: > > But having the test code in a comment > > seems ugly to me. Maybe there could be some CamlP4 hack to exclude > > it on normal compilation? > > Since you mentioned python, a culture where > unit tests are routinely written in > comments, Im surprised by your opinion. > Do you think all tests in comments are ugly or is there something > specific to batteries tests that make these ugly? Actually, In Python tests are not routinely written in comments. They are usually written in Files called test_whatever.py as test_whatever functions. Afterwards, people use test discovery tools like nose or py.test that search for such modules and construct JUnit-style TestCase classes out of these funtions and execute them. The advantage is that writing a test only requires to write a single function and does not need registration. Before there were test discovery tools people wrote test methods in test classes and executed that manually -- that is, they didn't write tests really, because it was terribly tedious. Your point about tests in comments is not entirely unbased: there are doctests which are written in document comments and represent a recorded console session that gets played back as test. Fancy concept, but not many people use it. In my opinion I dislike unit tests in comments, also because you throw away editor support and it feels hackish, especially if the language has a way of syntactic extension. Python doctests are on the verge of unreadability, but given it is meant as a console session, it is still kind of okay though not perfect. Hope that answer helps you :) regards, Marek