]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
ruby-format: Accept null precision.
authorBruno Haible <bruno@clisp.org>
Sun, 22 Jun 2025 01:09:48 +0000 (03:09 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 22 Jun 2025 01:09:48 +0000 (03:09 +0200)
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.

gettext-tools/src/format-ruby.c
gettext-tools/tests/format-ruby-1

index e58e6277374ba65c5fdbeb671c9ef975ae8e9001..7e371fef975985d56b1421dfbec4312322555878 100644 (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.
index 2294b3365ea609d6cd1570127bd0d7a3457c8b84..b473bb2caf294884c9b6c9edbf8f1f6cb20097f6 100755 (executable)
@@ -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)