source: project/release/4/hfs+/trunk/test.scm @ 14881

Last change on this file since 14881 was 14881, checked in by Jim Ursetto, 12 years ago

import hfs+ egg

File size: 2.1 KB
Line 
1;;; test hfs+ interface
2
3(use test)
4(use hfs+)
5(use files)
6
7;; Assumes UNIX files are created with no attributes.
8;; Untested: NOFOLLOW.  Setting resource forks.  Finder info.  Removing resource forks
9;; (evidently must set to "").
10
11(define file (create-temporary-file "hfs-test"))
12
13(test "empty initial attribute set"
14 '()
15 (list-extended-attributes file))
16
17;; (set-extended-attribute! file "com.apple.FinderInfo" (make-string 32 #\x00))
18(set-extended-attribute! file "chicken.baz" "quux")
19(set-extended-attribute! file "chicken.zot" "erp")
20(set-extended-attribute! file "chicken.foo" "bar")
21
22(test "list three attributes in chicken namespace"
23      '("chicken.baz" "chicken.foo" "chicken.zot")
24      (sort (list-extended-attributes file) string<?))
25(test "get three attributes in chicken namespace"
26      '("quux" "erp" "bar")
27      (list (get-extended-attribute file "chicken.baz")
28            (get-extended-attribute file "chicken.zot")
29            (get-extended-attribute file "chicken.foo")))
30
31(test "replace existing attribute"
32      #t
33      (begin
34        (set-extended-attribute! file "chicken.foo" "bar-updated" #:replace)
35        #t))
36(test-error "replace non-existent attribute (error)"
37            (set-extended-attribute! file "chicken.foo" "bar-updated" #:update))
38(test "create non-existent attribute ok"
39      #t
40      (begin
41        (set-extended-attribute! file "chicken.new" "new" #:create)
42        #t))
43(test-error "create existing attribute (error)"
44            (set-extended-attribute! file "chicken.new" "new" #:create))
45
46(remove-extended-attribute! file "chicken.foo")
47(test "three attributes after one removed"
48      '("chicken.baz" "chicken.new" "chicken.zot")
49      (sort (list-extended-attributes file) string<?))
50
51(for-each (lambda (x)
52            (remove-extended-attribute! file x))
53          (list-extended-attributes file))
54(test "remove remaining attributes"
55      '()
56      (sort (list-extended-attributes file) string<?))
57
58(test-error "remove non-existent attribute (error)"
59            (remove-extended-attribute! file "chicken.baz"))
60
61;;; further tests go here
62
63(delete-file file)
Note: See TracBrowser for help on using the repository browser.