1:
2:
3:
4:
5: (use gauche.test)
6:
7: (test-start "autoload")
8:
9: (add-load-path ".")
10:
11:
12: (test-section "autoload and implicit generic definition")
13:
14: (sys-system "rm -rf test.o")
15: (sys-mkdir "test.o" #o777)
16: (with-output-to-file "test.o/a.scm"
17: (lambda ()
18: (write '(autoload "test.o/b" foo1 foo2))
19: (write '(define-method foo1 ((x <string>)) 'foo1-string))
20: (write '(define-method foo2 ((x <string>)) 'foo2-string))
21: ))
22: (with-output-to-file "test.o/b.scm"
23: (lambda ()
24: (write '(define-method foo1 ((x <list>)) 'foo1-list))
25: (write '(define-method foo2 ((x <list>)) 'foo2-list))
26: ))
27:
28: (test* "autoload triggered by implicit generic definition" 'foo1-list
29: (and (load "test.o/a") (foo1 '())))
30:
31: (test* "autoload triggered by implicit generic definition" 'foo2-list
32: (foo2 '()))
33:
34: (sys-system "rm -rf test.o")
35:
36:
37: (test-section "autoload and class redefinition check")
38:
39: (sys-mkdir "test.o" #o777)
40: (with-output-to-file "test.o/a.scm"
41: (lambda ()
42: (write '(autoload "test.o/b" <foo>))
43: (write '(define-class <foo> () ((x) (y :init-value 'y))))
44: ))
45: (with-output-to-file "test.o/b.scm"
46: (lambda ()
47: (write '(define-class <foo> () ((x :init-value 'x))))
48: (write '(define *foo* (make <foo>)))
49: ))
50:
51: (test* "autoload triggered by class redefinition check" 'y
52: (and (load "test.o/a")
53: (slot-ref *foo* 'y)))
54:
55: (sys-system "rm -rf test.o")
56:
57:
58: (test-section "circular autoload")
59:
60: (sys-mkdir "test.o" #o777)
61: (with-output-to-file "test.o/a.scm"
62: (lambda ()
63: (write '(autoload "test.o/b" <bar>))
64: (write '(define-class <bar> () ()))
65: ))
66: (with-output-to-file "test.o/b.scm"
67: (lambda ()
68: (write '(define-method bar ((x <bar>)) x))
69: ))
70:
71: (test* "circular-autoload" *test-error*
72: (load "test.o/a"))
73:
74: (sys-system "rm -rf test.o")
75:
76:
77: (test-end)
78:
79:
80: