Changeset 26869 in project


Ignore:
Timestamp:
06/10/12 12:56:47 (9 years ago)
Author:
sjamaan
Message:

spiffy: Make it easier to compile the testsuite (for whatever silly reason I wanted this...)

Location:
release/4/spiffy/trunk/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/spiffy/trunk/tests/run.scm

    r26866 r26869  
    1 (use test irregex)
    2 
    3 (load "../spiffy.scm")
     1(use test irregex intarweb)
     2
     3(load "../spiffy") ;; Change this to (use spiffy) when compiling tests
    44
    55(test-begin "spiffy")
    66
    7 (load "testlib")
     7(include "testlib.scm")
    88
    99(define noway "No way, Jose!")
     
    168168             "/blah" "redirect-host"
    169169             send-headers: `((host ("redirect-host" . 8081))) absolute-uri: #f)
    170 (test-response "internal error" (500 EXN) "/cause-error" "error-host")
     170(test-response "internal error" (500 "This should give a 500 error")
     171               "/cause-error" "error-host")
    171172(test-response "Variable length (no content-length header)" (200 "foo")
    172173               "/whatever" "unknown-length-host")
  • release/4/spiffy/trunk/tests/testlib.scm

    r26192 r26869  
    3838(define response-error? #f)
    3939
    40 (define EXN "Some exception was thrown")
    41 
    4240(define (start-spiffy)
    4341  (check-port)
     
    5250                          (handle-exception
    5351                           (lambda (exn chain)
    54                              (log-to (error-log) (build-error-message exn chain #t))
    55                              (set! response-error? #t)
    56                              (send-string/code 500 "Internal server error" EXN))))
     52                             (let ((m ((condition-property-accessor 'exn 'message) exn))
     53                                   (a ((condition-property-accessor 'exn 'arguments) exn)))
     54                               (log-to (error-log) (build-error-message exn chain #t))
     55                               (set! response-error? #t)
     56                               (send-string/code 500 "Internal server error"
     57                                                 (if (and a (not (null? a)))
     58                                                     (sprintf "~A ~A" m a)
     59                                                     m))))))
    5760             (start-server)))))
    5861  (thread-start! spiffy-thread)
Note: See TracChangeset for help on using the changeset viewer.