pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: expressive test macros (was: Report test_atomic_ops() failures consistently, via macros)
Date: Mon, 7 Oct 2019 21:59:46 -0700
Message-ID: <20191008045946.GA4054860@rfd.leadboat.com> (raw)
In-Reply-To: <f0906c55-87cb-e940-b27b-99d41c14d44d@2ndquadrant.com>
References: <E1iGnXq-0001K7-Aj@gemulon.postgresql.org>
	<20191005190729.6sx7g23ifdu65s7s@alap3.anarazel.de>
	<20191006022038.GB4023404@rfd.leadboat.com>
	<f0906c55-87cb-e940-b27b-99d41c14d44d@2ndquadrant.com>

On Mon, Oct 07, 2019 at 09:56:20PM +0200, Peter Eisentraut wrote:
> On 2019-10-06 04:20, Noah Misch wrote:
> >  elog(ERROR, \
> >       "%s yielded %u, expected %s (%u) in file \"%s\" line %u", \
> >       #result_expr, result, #expected_expr, expected, __FILE__, __LINE__); \

> I've been meaning to propose some JUnit-style more-specific Assert
> variants such as AssertEquals for this reason.  But as Tom writes
> nearby, it should be a straight wrapper around Assert, not elog.  So
> these need to be named separately.

Agreed.

> Btw., JUnit uses the ordering convention assertEquals(expected, actual),
> whereas Perl Test::More uses is(actual, expected).  Let's make sure we
> pick something and stick with it.

Since we write "if (actual == expected)", I prefer f(actual, expected).  CUnit
uses CU_ASSERT_EQUAL(actual, expected).





view thread (10+ messages)  latest in thread

Message-ID: <20191008045946.GA4054860@rfd.leadboat.com>
Permalink:  ../20191008045946.GA4054860@rfd.leadboat.com/
Also on:    postgresql.org/message-id/20191008045946.GA4054860@rfd.leadboat.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: noah@leadboat.com, peter.eisentraut@2ndquadrant.com, andres@anarazel.de, pgsql-hackers@lists.postgresql.org
  Subject: Re: expressive test macros (was: Report test_atomic_ops() failures consistently, via macros)
  In-Reply-To: <20191008045946.GA4054860@rfd.leadboat.com>
  References: <E1iGnXq-0001K7-Aj@gemulon.postgresql.org> <20191005190729.6sx7g23ifdu65s7s@alap3.anarazel.de> <20191006022038.GB4023404@rfd.leadboat.com> <f0906c55-87cb-e940-b27b-99d41c14d44d@2ndquadrant.com> <20191008045946.GA4054860@rfd.leadboat.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox