groff
[Top][All Lists]
Advanced

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

Re: GNUism in groff tests


From: Ralph Corderoy
Subject: Re: GNUism in groff tests
Date: Tue, 31 Dec 2019 09:02:52 +0000

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/cgit/groff.git/tree/src/roff/groff/tests/on-latin1-device-oq-is-0x27.sh

    expected="' = '"

    actual=$("$groff" -Tlatin1 <<EOF
    .pl 1v
    \[oq] = '
    EOF
    )

    diff -u <(echo "$expected") <(echo "$actual")

It looks like the test harness needs a common shell script that provides
convenience functions.  Then the test script can read more like

    # All run under `set -eu' with a trap on EXIT.

    title 'Check -Tlatin1's \(oq'

    in=$(tmp) want=$(tmp)   # Values won't need quoting.
    cat >$in <<\E
    .pl 1
    \e(oq = \(oq
    E
    echo '\(oq = `' >$want

    got=$(tmp) err=$(tmp)
    run "$groff" -Tlatin <$in >$got 2>$err   # Allows inserting valgrind(1).
    empty $err
    equal $got $want   # If different, shows start of diff output.

    cleanup   # Removes tmp files if tests successful.

with the functions evolving over time to suit groff's needs, and
presumably fitting in with Automake's parallel-test harness, if that's
what's being used.

-- 
Cheers, Ralph.



reply via email to

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