1;;; -*- Lisp -*-
2
3#+scl
4(require :http-library)
5
6;; Compare the source files with local versions before loading them.
7#+(and (or abcl scl) trust-the-net)
8(flet ((compare (url local)
9         (with-open-file (stream1 url :element-type 'character
10                                      :external-format :utf-8)
11           (with-open-file (stream2 local :element-type 'character
12                                          :external-format :utf-8)
13             (loop
14               (let ((ch1 (read-char stream1 nil nil))
15                     (ch2 (read-char stream2 nil nil)))
16                 (unless (eql ch1 ch2)
17                   (error "Unexpected source content."))
18                 (unless (and ch1 ch2)
19                   (return))))))))
20  (let* ((system (find-system "test-urls-1"))
21         (url (asdf:component-pathname
22               (asdf:find-component system "test"))))
23    (compare url "test.lisp"))
24
25  (load-system 'test-urls-1)
26
27  ;; test that it compiled
28  (let* ((path (component-pathname
29                (find-component "test-urls-1" "test")))
30         (test (test-fasl path))
31         (test-date (file-write-date test)))
32    (format t "~&test-urls-1 1: ~S ~S~%" test test-date)
33    (assert test-date)))
34