ruby-format: Accept null precision.

Proof that it's valid:
$ ruby
puts "%.f" % 3.1415926535

* gettext-tools/src/format-ruby.c: Clarify comment regarding the precision.
* gettext-tools/tests/format-ruby-1: Add test cases with null precision.
This commit is contained in:
Bruno Haible 2025-06-22 03:09:48 +02:00
parent 3e846209ca
commit 5b2a00875c
2 changed files with 5 additions and 1 deletions

View File

@ -50,7 +50,7 @@
- '*', indicating a width, taken from the argument list,
- '*' and a digit sequence, followed by '$', indicating a width, taken
from a positional argument,
- '.' and a digit sequence, indicating a precision,
- '.' and an optional nonempty digit sequence, indicating a precision,
- '.' '*', indicating a precision, taken from the argument list,
- '.' '*' and a digit sequence, followed by '$', indicating a precision,
taken from a positional argument.

View File

@ -241,6 +241,10 @@ cat <<\EOF > f-r-1.data
"abc%2$2*1$g"
# Invalid: twice width (numbered)
"abc%2$*1$2g"
# Valid: null precision (unnumbered)
"abc%.f"
# Valid: null precision (numbered)
"abc%1$.f"
# Invalid: twice precision (unnumbered)
"abc%.4.2g"
# Invalid: twice precision (numbered)