bistromathic: beware of portability issues with readline

In some cases readline emits a trailing spaces after the last
suggestion, which results in errors such as:

```
-(       -       atan    cos     exp     ln      number  sin     sqrt$
+(       -       atan    cos     exp     ln      number  sin     sqrt    $
```

Reported by Christopher Nielsen <mascguy@github.com>.
<https://trac.macports.org/ticket/59927#comment:48>
<https://trac.macports.org/attachment/ticket/59927/bison-3.7.6-test-10.13.test-suite.log>

* examples/test (run): Add support for -t.
* examples/c/bistromathic/bistromathic.test: Use it.
This commit is contained in:
Akim Demaille
2021-08-03 07:33:33 +02:00
parent 7f1e9249d0
commit 4b802d6417
2 changed files with 22 additions and 8 deletions

View File

@@ -306,10 +306,17 @@ esac
sed -e 's/\\t/ /g' >input <<EOF
(1+\t\t
EOF
run 0 '> (1+
# Nuke the possible trailing white spaces in the effective output.
# This is to cope with some readlines that pad all the suggestions
# with white spaces (for alignment), including the last one on a line.
#
# See for instance <https://trac.macports.org/ticket/59927#comment:48>
# and its test-suite.log:
# <https://trac.macports.org/attachment/ticket/59927/bison-3.7.6-test-10.13.test-suite.log>
run -t 0 '> (1+
( - atan cos exp ln number sin sqrt
> (1+
> ''
>
err: 1.4: syntax error: expected - or ( or number or function or variable before end of file
err: 1 | (1+
err: | ^'