groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNUism in groff tests


From: G. Branden Robinson
Subject: Re: GNUism in groff tests
Date: Tue, 31 Dec 2019 16:25:36 +1100
User-agent: NeoMutt/20180716

At 2019-12-30T18:12:58+0100, Ingo Schwarze wrote:
>  - The <() syntax looks like a GNUism to me.

It's an rc-ism.  Or Tom Duff-ism, if you will[1].

>  - Everything else doesn't appear to actually require bash(1).

Probably cut-and-pastage on my part.

> diff --git a/src/roff/groff/tests/on-latin1-device-oq-is-0x27.sh 
> b/src/roff/groff/tests/on-latin1-device-oq-is-0x27.sh
> index a0d81f19..20406333 100755
> --- a/src/roff/groff/tests/on-latin1-device-oq-is-0x27.sh
> +++ b/src/roff/groff/tests/on-latin1-device-oq-is-0x27.sh
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env bash
> +#!/bin/sh
>  #
>  # Copyright (C) 2019 Free Software Foundation, Inc.
>  #
> @@ -22,10 +22,10 @@ groff="${abs_top_builddir:-.}/test-groff"
>  
>  expected="' = '"
>  
> -actual=$("$groff" -Tlatin1 <<EOF
> -.pl 1v
> -\[oq] = '
> -EOF
> -)
> +actual=$(printf ".pl 1v\n\\\\[oq] = '\n" | "$groff" -Tlatin1)

"\n\\\\[oq]" ?!

:-/

"So much quoting and escaping is hard to read either way."

I strongly prefer my method, here.  And I'm willing to maintain it.

> -diff -u <(echo "$expected") <(echo "$actual")
> +test "X$actual" = "X$expected" && exit 0

NAK.  Why are those "X"s there?

We must not write our test scripts in Autoconf shell.

test "$actual" = "$expected" is entirely adequate, and POSIX-compliant.
Adding string literals is a bodge to work around broken old pre-POSIX
shells (or pre-POSIX test(1)).  The details are in the GNU Autoconf
manual somewhere.

> +
> +echo "expected: $expected"
> +echo "actual:   $actual"
> +exit 1

diff output sure is easier to read.  I regret losing that.

For the next three files I have the same two foregoing comments.

> --- a/src/roff/groff/tests/string_case_xform_errors.sh
> --- a/src/roff/groff/tests/string_case_xform_requests.sh
> --- a/src/roff/groff/tests/string_case_xform_unicode_escape.sh

For the rest...

> --- a/tmac/tests/an-old_CS_register_off.sh
> --- a/tmac/tests/an-old_CS_register_on.sh
> --- a/tmac/tests/an-old_CS_register_unspecified.sh
> --- a/tmac/tests/an-old_CT_register_off.sh
> --- a/tmac/tests/an-old_CT_register_on.sh
> --- a/tmac/tests/an-old_CT_register_unspecified.sh

+1.

Regards,
Branden

[1] http://doc.cat-v.org/plan_9/4th_edition/papers/rc

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]