Re: pic anomalies

2019-12-31 Thread Ingo Schwarze
Hi Doug, Doug McIlroy wrote on Tue, Dec 31, 2019 at 10:39:53AM -0500: > It looks like Ralph has turned up a really strange bug in pic > that suppresses pic's usual diagnosis of a bare % in a format. > > The example can be boiled down to > sprintf("%g% %",1) > which produces > 1%

Re: GNUism in groff tests, was: pic anomalies

2019-12-31 Thread Ingo Schwarze
Hi Werner, Werner LEMBERG wrote on Tue, Dec 31, 2019 at 03:34:17PM +0100: > I think the proper way for testing groff would be to make it run > with a fuzzer, Yes, that would no doubt be useful. We did that for mandoc. It found about 50 bugs in the first year and a few dozen more later on. I pre

Re: pic anomalies

2019-12-31 Thread Doug McIlroy
> Getting back on topic, are we sure we want to deviate from GNU pic's > current behaviour without checking historical norms of other pics? > > $ printf '%s\n' \ > .PS 'print sprintf("%.17g %.0f% % %%", 3.14, 42, 99)' .PE | > > pic >/dev/null > 3.1401 42% % %% > > Th

Re: GNUism in groff tests, was: pic anomalies

2019-12-31 Thread Werner LEMBERG
> A framework helps with none of that. But a framework can easily be > so heavy that it distracts from the actual job. Certainly, we don't > need a framework without content. I think the proper way for testing groff would be to make it run with a fuzzer, using some very simple and small input

Re: GNUism in groff tests, was: pic anomalies

2019-12-31 Thread Ingo Schwarze
Hi John, John Gardner wrote on Tue, Dec 31, 2019 at 01:13:19PM +1100: > Wouldn't having a TAP harness be > preferable to hand-spun shell-scripts? Introducing a test framework is a solution in search of a problem. :-/ There are important things to do in groff. It is

Re: GNUism in groff tests, was: pic anomalies

2019-12-31 Thread Ingo Schwarze
Hi Ralph, Ralph Corderoy wrote on Tue, Dec 31, 2019 at 12:43:48PM +: >>> For some version of POSIX. :-) > ... >> But POSIX is actually unusually benign in this respect. POSIX 2008 is >> still in force and widely adopted (though of course, many commercial >> UNIXes still implement POSIX 2001

Re: GNUism in groff tests

2019-12-31 Thread Ingo Schwarze
Hi Branden, G. Branden Robinson wrote on Tue, Dec 31, 2019 at 04:25:36PM +1100: > At 2019-12-30T18:12:58+0100, Ingo Schwarze wrote: >> +test "X$actual" = "X$expected" && exit 0 > test "$actual" = "$expected" is entirely adequate, and POSIX-compliant. > Adding string literals is a bodge to work a

Re: GNUism in groff tests, was: pic anomalies

2019-12-31 Thread Ralph Corderoy
Hi Ingo, > > For some version of POSIX. :-) ... > But POSIX is actually unusually benign in this respect. POSIX 2008 is > still in force and widely adopted (though of course, many commercial > UNIXes still implement POSIX 2001, but i doubt that's relevant in the > present context). In a few yea

Re: GNUism in groff tests

2019-12-31 Thread Ingo Schwarze
Hi Branden, G. Branden Robinson wrote on Tue, Dec 31, 2019 at 04:34:56PM +1100: > I still prefer my here document because it _looks_ like an actual > groff document, and therefore more valuable for pedagogical purposes, I agree that your here document is the most readable of the three, and i als

Re: GNUism in groff tests, was: pic anomalies

2019-12-31 Thread John Gardner
> For some standards, clarifying which one you want to follow can > be a tough problem (e.g. CSS, anyone?) CSS isn't one standard, but a family of standards . Each of which has varying levels of maturity, and only those that are listed as "Recommendation"

Re: GNUism in groff tests, was: pic anomalies

2019-12-31 Thread Ingo Schwarze
Hi Ralph, Ralph Corderoy wrote on Tue, Dec 31, 2019 at 08:32:30AM +: > Branden Robinson wrote: >> I don't mind limiting ourselves to portable POSIX sh > For some version of POSIX. :-) For some standards, clarifying which one you want to follow can be a tough problem (e.g. CSS, anyone?). B

Re: GNUism in groff tests, was: pic anomalies

2019-12-31 Thread John Gardner
> I've just read the specification and I don't think it buys us much. I wasn't suggesting TAP so much as recommending Perl's prove(1) for handling unit tests. It eliminates portability headaches and issues with Bashisms , and is pretty time-tested as far as assu

Re: GNUism in groff tests

2019-12-31 Thread Ralph Corderoy
Hi Branden, > > Heirloom sh is happy with it if I replace $() with ``. > > Oy vey. That's a cure worse than the disease! I was just using that as an another data point; a Bourne shell doesn't require the single quote to be escaped. Returning to the original, http://git.savannah.gnu.org/cg

Re: GNUism in groff tests, was: pic anomalies

2019-12-31 Thread Ralph Corderoy
Hi Branden, > And who knows--maybe a gditroff page counting utility is something we > should write and add to the distribution. $ printf '%s\n.bp\n' `seq 42` | groff -Z | grep -c ^p 43 -- Cheers, Ralph.

Re: GNUism in groff tests, was: pic anomalies

2019-12-31 Thread Ralph Corderoy
Hi Branden, > I don't mind limiting ourselves to portable POSIX sh For some version of POSIX. :-) > I do regret losing the elegance of: > > diff <(expected) <(actual) Users of this syntax often ignore the exit status of the cmd in <(cmd). -- Cheers, Ralph.

Re: GNUism in groff tests, was: pic anomalies

2019-12-31 Thread Ralph Corderoy
Hi John, > Wouldn't having a TAP harness be > preferable to hand-spun shell-scripts? I've just read the specification and I don't think it buys us much. Something still needs to set up the test, run it, echo `ok' for TAP, and clean up, and something above that needs to