(linenum→info "unix/slp.c:2238")

gauche/0.8.12/test/logger.scm

    1: ;;
    2: ;; testing gauche.logger
    3: ;;
    4: 
    5: ;; $Id: logger.scm,v 1.6 2003/02/06 11:47:53 shirok Exp $
    6: 
    7: (use gauche.test)
    8: 
    9: ;; NB: logger uses gauche.fcntl.  Before 'make link', it can't be
   10: ;; loaded by 'use'.
   11: (when (file-exists? "../ext/fcntl/fcntl.scm")
   12:   (add-load-path "../ext/fcntl")
   13:   (load "../ext/fcntl/fcntl"))
   14: (when (file-exists? "../ext/syslog/syslog.scm")
   15:   (add-load-path "../ext/syslog")
   16:   (load "../ext/syslog/syslog"))
   17: (test-start "logger")
   18: (use gauche.logger)
   19: (test-module 'gauche.logger)
   20: 
   21: ;;-------------------------------------------------------------------------
   22: (test-section "log-open")
   23: 
   24: (sys-system "rm -f test.o")
   25: 
   26: ;; these shouldn't go to the log
   27: (log-format "testing...")
   28: (log-format "testing ~a..." 2)
   29: (log-format "testing ~a..." 3)
   30: 
   31: (log-open "test.o")
   32: 
   33: (log-format "real testing...")
   34: (log-format "real testing ~a..." 2)
   35: (log-format "output string\ncontaining newline\ncharacters")
   36: 
   37: (log-open #f)
   38: 
   39: (log-format "fake testing...")
   40: 
   41: (log-open "test.o")
   42: 
   43: (log-format "real testing again...")
   44: 
   45: (test "log-open"
   46:       '("real testing..."
   47:         "real testing 2..."
   48:         "output string"
   49:         "containing newline"
   50:         "characters"
   51:         "real testing again...")
   52:       (lambda ()
   53:         (map (lambda (line)
   54:                (cond ((#/^... .. ..:..:.. .+\[\d+\]: (.*)$/ line)
   55:                       => (lambda (m) (m 1)))
   56:                      (else #f)))
   57:              (call-with-input-file "test.o" port->string-list))))
   58: 
   59: (sys-system "rm -f test.o")
   60: 
   61: ;;-------------------------------------------------------------------------
   62: (test-section "customized formatter")
   63: 
   64: (sys-system "rm -f test.o")
   65: 
   66: (log-open "test.o" :prefix "zeepa:")
   67: (log-format "booba bunba bomba")
   68: 
   69: (test "customized formatter"
   70:       '("zeepa:booba bunba bomba")
   71:       (lambda ()
   72:         (call-with-input-file "test.o" port->string-list)))
   73: 
   74: (sys-system "rm -f test.o")
   75: 
   76: (log-open "test.o" :prefix (lambda (drain) "poopa:"))
   77: (log-format "booba bunba bomba")
   78: 
   79: (test "customized formatter"
   80:       '("poopa:booba bunba bomba")
   81:       (lambda ()
   82:         (call-with-input-file "test.o" port->string-list)))
   83: 
   84: (test-end)
Syntax (Markdown)