Mercurial > hg > xemacs-beta
comparison tests/automated/lisp-tests.el @ 5244:04811a268716
Be clearer in our error messages, #'canonicalize-inst-pair, #'canonicalize-spec
lisp/ChangeLog addition:
2010-08-15 Aidan Kehoe <kehoea@parhasard.net>
* specifier.el (canonicalize-inst-pair, canonicalize-spec):
If a specifier tag set is correct, but an instantiator is not in
an accepted format, don't error with the message "Invalid
specifier tag set".
Also, when we error, use error-symbols, for better structured
error handling and more ease when testing.
tests/ChangeLog addition:
2010-08-15 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-tests.el:
(not, not, invalid-argument, invalid-argument):
Check that error messages from the image specifier instantiator
code are clearer than they used to be.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 15 Aug 2010 15:42:45 +0100 |
parents | 808131ba4a57 |
children | be436ac36ba4 308d34e9f07d |
comparison
equal
deleted
inserted
replaced
5243:808131ba4a57 | 5244:04811a268716 |
---|---|
2372 (and (eql called 5) | 2372 (and (eql called 5) |
2373 (setcdr (nthcdr 3 sequence) nil)) | 2373 (setcdr (nthcdr 3 sequence) nil)) |
2374 (garbage-collect)))))) | 2374 (garbage-collect)))))) |
2375 "checking we can amputate lists without crashing #'reduce") | 2375 "checking we can amputate lists without crashing #'reduce") |
2376 | 2376 |
2377 (Assert (not (eq t (canonicalize-inst-list | |
2378 `(((mswindows) . [string :data ,(make-string 20 0)]) | |
2379 ((tty) . [string :data " "])) 'image t))) | |
2380 "checking mswindows is always available as a specifier tag") | |
2381 | |
2382 (Assert (not (eq t (canonicalize-inst-list | |
2383 `(((mswindows) . [nothing]) | |
2384 ((tty) . [string :data " "])) | |
2385 'image t))) | |
2386 "checking the correct syntax for a nothing image specifier works") | |
2387 | |
2388 (Check-Error-Message invalid-argument "^Invalid specifier tag set" | |
2389 (canonicalize-inst-list | |
2390 `(((,(gensym)) . [nothing]) | |
2391 ((tty) . [string :data " "])) | |
2392 'image)) | |
2393 | |
2394 (Check-Error-Message invalid-argument "^Unrecognized keyword" | |
2395 (canonicalize-inst-list | |
2396 `(((mswindows) . [nothing :data "hi there"]) | |
2397 ((tty) . [string :data " "])) 'image)) | |
2398 | |
2399 ;; If we combine both the specifier inst list problems, we get the | |
2400 ;; unrecognized keyword error first, not the invalid specifier tag set | |
2401 ;; error. This is a little unintuitive; the specifier tag set thing is | |
2402 ;; processed first, and would seem to be more important. But anyone writing | |
2403 ;; code needs to solve both problems, it's reasonable to ask them to do it | |
2404 ;; in series rather than in parallel. | |
2405 | |
2377 (when (featurep 'ratio) | 2406 (when (featurep 'ratio) |
2378 (Assert (not (eql '1/2 (read (prin1-to-string (intern "1/2"))))) | 2407 (Assert (not (eql '1/2 (read (prin1-to-string (intern "1/2"))))) |
2379 "checking symbols with ratio-like names are printed distinctly") | 2408 "checking symbols with ratio-like names are printed distinctly") |
2380 (Assert (not (eql '1/5 (read (prin1-to-string (intern "2/10"))))) | 2409 (Assert (not (eql '1/5 (read (prin1-to-string (intern "2/10"))))) |
2381 "checking symbol named \"2/10\" not eql to ratio 1/5 on read")) | 2410 "checking symbol named \"2/10\" not eql to ratio 1/5 on read")) |