Add tests for `-Wformat' and gettext.
authorLudovic Courtès <ludo@gnu.org>
Thu, 14 Apr 2011 21:14:14 +0000 (23:14 +0200)
committerLudovic Courtès <ludo@gnu.org>
Thu, 14 Apr 2011 21:14:14 +0000 (23:14 +0200)
* test-suite/tests/tree-il.test ("warnings")["non-literal format string
  using gettext", "one missing argument, gettext"]: New tests.

test-suite/tests/tree-il.test

index 8ea24434359701c0dc169955e4d268bf80c3ef6b..1b86b99fc9598f7b6cdf09e99d9f3e363a0d90bb 100644 (file)
               (number? (string-contains (car w)
                                         "non-literal format string")))))
 
+     (pass-if "non-literal format string using gettext"
+       (null? (call-with-warnings
+               (lambda ()
+                 (compile '(format #t (_ "~A ~A!") "hello" "world")
+                          #:opts %opts-w-format
+                          #:to 'assembly)))))
+
      (pass-if "wrong format string"
        (let ((w (call-with-warnings
                  (lambda ()
               (number? (string-contains (car w)
                                         "expected 1, got 0")))))
 
+     (pass-if "one missing argument, gettext"
+       (let ((w (call-with-warnings
+                 (lambda ()
+                   (compile '(format some-port (_ "foo ~A~%"))
+                            #:opts %opts-w-format
+                            #:to 'assembly)))))
+         (and (= (length w) 1)
+              (number? (string-contains (car w)
+                                        "expected 1, got 0")))))
+
      (pass-if "two missing arguments"
        (let ((w (call-with-warnings
                  (lambda ()