a small bug fix for assert-util.ss
Andrew Wilcox <schematics-dev-1nkB91yrSd/a/[email protected]> Fri, 29 Apr 2005 12:06:24 -0700 (PDT)
| Newsgroups | gmane.lisp.scheme.plt.schematics |
|---|---|
| Message-ID | <[email protected]> |
Here's a small bug fix for assert-util.ss.
The MzScheme user manual says that SYNTAX-LINE and SYNTAX-COLUMN
returns #f if the source line or column is unknown.
The following patch for LOCATION->STRING in assert-util.ss (as of the
SchemeUnit 2.0 release) avoids raising an error in NUMBER->STRING if
SYNTAX-LINE or SYNTAX-COLUMN ever did in fact return #f.
I dedicate this code I've written here to the public domain, so if you
find this patch useful, you are free to incorporate it into SchemeUnit
under its current license. In addition, should you some day decide to
release SchemeUnit under some different license, you will not need to
locate me to get my permission to use this code under the new license.
Andrew Wilcox
--- orig/assert-util.ss 2005-04-29 13:37:01.000000000 -0400
+++ mod/assert-util.ss 2005-04-29 14:46:00.000000000 -0400
@@ -30,15 +34,24 @@
((not source) "unknown")
(else (let ((port (open-output-string)))
(display source port)
- (get-output-string port)))))))
+ (get-output-string port))))))
+
+ (colon-number
+ (lambda (num)
+ (string-append ":" (number->string num)))))
+
(match-lambda
((list source line column position span source-module)
- (string-append (source->string source)
- ":"
- (number->string line)
- ":"
- (number->string column))))))
+ (cond ((and column line)
+ (string-append (source->string source)
+ (colon-number line)
+ (colon-number column)))
+ (line
+ (string-append (source->string source)
+ (colon-number line)))
+ (else
+ (source->string source)))))))
;; get-assertion-info : symbol (list-of assertion-info) -> any
;;
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20