Augment -Wformat' analysis with support for ~:h'.
* module/language/tree-il/analyze.scm (format-string-argument-count):
Add support for ~h.
* test-suite/tests/tree-il.test ("warnings")["format"]("~h", "~:h with
locale object", "~:h without locale object"): New tests.
This commit is contained in:
parent
afd08fdf87
commit
b4af80a423
2 changed files with 33 additions and 1 deletions
|
|
@ -2243,6 +2243,32 @@
|
|||
(number? (string-contains (car w)
|
||||
"expected 1, got 2")))))
|
||||
|
||||
(pass-if "~h"
|
||||
(null? (call-with-warnings
|
||||
(lambda ()
|
||||
(compile '((@ (ice-9 format) format) #t
|
||||
"foo ~h ~a~%" 123.4 'bar)
|
||||
#:opts %opts-w-format
|
||||
#:to 'assembly)))))
|
||||
|
||||
(pass-if "~:h with locale object"
|
||||
(null? (call-with-warnings
|
||||
(lambda ()
|
||||
(compile '((@ (ice-9 format) format) #t
|
||||
"foo ~:h~%" 123.4 %global-locale)
|
||||
#:opts %opts-w-format
|
||||
#:to 'assembly)))))
|
||||
|
||||
(pass-if "~:h without locale object"
|
||||
(let ((w (call-with-warnings
|
||||
(lambda ()
|
||||
(compile '((@ (ice-9 format) format) #t "foo ~,2:h" 123.4)
|
||||
#:opts %opts-w-format
|
||||
#:to 'assembly)))))
|
||||
(and (= (length w) 1)
|
||||
(number? (string-contains (car w)
|
||||
"expected 2, got 1")))))
|
||||
|
||||
(with-test-prefix "conditionals"
|
||||
(pass-if "literals"
|
||||
(null? (call-with-warnings
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue