diff options
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/editfns-tests.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index 8019eb03838..f76c6c9fd36 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el | |||
| @@ -177,4 +177,22 @@ | |||
| 177 | (format-time-string "%Y-%m-%d %H:%M:%S.%3N %z" nil | 177 | (format-time-string "%Y-%m-%d %H:%M:%S.%3N %z" nil |
| 178 | (concat (make-string 2048 ?X) "0"))))) | 178 | (concat (make-string 2048 ?X) "0"))))) |
| 179 | 179 | ||
| 180 | (ert-deftest format-with-field () | ||
| 181 | (should (equal (format "First argument %2$s, then %s, then %1$s" 1 2 3) | ||
| 182 | "First argument 2, then 3, then 1")) | ||
| 183 | (should (equal (format "a %2$s %d %1$d %2$S %d %d b" 11 "22" 33 44) | ||
| 184 | "a 22 33 11 \"22\" 33 44 b")) | ||
| 185 | (should (equal (format "a %08$s %s b" 1 2 3 4 5 6 7 8 9) "a 8 9 b")) | ||
| 186 | (should (equal (should-error (format "a %999999$s b" 11)) | ||
| 187 | '(error "Not enough arguments for format string"))) | ||
| 188 | (should (equal (should-error (format "a %$s b" 11)) | ||
| 189 | ;; FIXME: there shouldn't be two % in the error | ||
| 190 | ;; string! | ||
| 191 | '(error "Invalid format operation %%$"))) | ||
| 192 | (should (equal (should-error (format "a %0$s b" 11)) | ||
| 193 | '(error "Invalid field number `0'"))) | ||
| 194 | (should (equal | ||
| 195 | (should-error (format "a %1$% %s b" 11)) | ||
| 196 | '(error "Field number specified together with `%' conversion")))) | ||
| 197 | |||
| 180 | ;;; editfns-tests.el ends here | 198 | ;;; editfns-tests.el ends here |