comparison man/internals/internals.texi @ 973:ea6a06f7bf2c

[xemacs-hg @ 2002-08-22 14:56:23 by stephent] implement test skipping <87d6sblzat.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Thu, 22 Aug 2002 14:56:32 +0000
parents a306b7c7742d
children ccaf90c5a53a
comparison
equal deleted inserted replaced
972:3fd7fb7868b3 973:ea6a06f7bf2c
3500 substantial temporary scaffolding to create the environment that elicits 3500 substantial temporary scaffolding to create the environment that elicits
3501 the bugs, but the top-level Makefile and @file{test-harness.el} handle 3501 the bugs, but the top-level Makefile and @file{test-harness.el} handle
3502 the running and collection of results from the @code{Assert}, 3502 the running and collection of results from the @code{Assert},
3503 @code{Check-Error}, @code{Check-Error-Message}, and @code{Check-Message} 3503 @code{Check-Error}, @code{Check-Error-Message}, and @code{Check-Message}
3504 macros. 3504 macros.
3505
3506 In general, you should avoid using functionality from packages in your
3507 tests, because you can't be sure that everyone will have the required
3508 package. However, if you've got a test that works, by all means add it.
3509 Simply wrap the test in an appropriate test, add a notice that the test
3510 was skipped, and update the @code{skipped-test-reasons} hashtable.
3511 Here's an example from @file{syntax-tests.el}:
3512
3513 @example
3514 ;; Test forward-comment at buffer boundaries
3515 (with-temp-buffer
3516
3517 ;; try to use exactly what you need: featurep, boundp, fboundp
3518 (if (not (fboundp 'c-mode))
3519
3520 ;; We should provide a standard function for this boilerplate,
3521 ;; probably called `Skip-Test' -- check for that API with C-h f
3522 (let* ((reason "c-mode unavailable")
3523 (count (gethash reason skipped-test-reasons)))
3524 (puthash reason (if (null count) 1 (1+ count))
3525 skipped-test-reasons)
3526 (Print-Skip "comment and parse-partial-sexp tests" reason))
3527
3528 ;; and here's the test code
3529 (c-mode)
3530 (insert "// comment\n")
3531 (forward-comment -2)
3532 (Assert (eq (point) (point-min)))
3533 (let ((point (point)))
3534 (insert "/* comment */")
3535 (goto-char point)
3536 (forward-comment 2)
3537 (Assert (eq (point) (point-max)))
3538 (parse-partial-sexp point (point-max)))))
3539 @end example
3540
3541 @code{Skip-Test} is intended for use with features that are normally
3542 present in typical configurations. For truly optional features, or
3543 tests that apply to one of several alternative implementations (eg, to
3544 GTK widgets, but not Athena, Motif, MS Windows, or Carbon), simply
3545 silently omit the test.
3546
3505 3547
3506 @node CVS Techniques, A Summary of the Various XEmacs Modules, Regression Testing XEmacs, Top 3548 @node CVS Techniques, A Summary of the Various XEmacs Modules, Regression Testing XEmacs, Top
3507 @chapter CVS Techniques 3549 @chapter CVS Techniques
3508 @cindex CVS techniques 3550 @cindex CVS techniques
3509 3551