-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathports-parameters.sst
70 lines (48 loc) · 1.4 KB
/
ports-parameters.sst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
(define tmp-file-path-1 (string-append "/tmp/vonuvoli-scheme--tests--ports-native--1--" (number->string (current-jiffy)) ".txt")) => !ignore
(define tmp-file-path-2 (string-append "/tmp/vonuvoli-scheme--tests--ports-native--2--" (number->string (current-jiffy)) ".txt")) => !ignore
(file-exists? tmp-file-path-1) => #f
(file-exists? tmp-file-path-2) => #f
(call-with-output-file tmp-file-path-1
(lambda (port)
(values
(write-char #\a port)
(write-u8 98 port)
(write-string "c" port)
(write-bytevector #u8(100) port)
)))
=> #values(#void #void #void #void)
(call-with-input-file tmp-file-path-1
(lambda (port)
(values
(read-char port)
(read-u8 port)
(read-string 1 port)
(read-bytevector 1 port)
(eof-object? (read-u8 port))
)))
=> #values(#\a 98 "c" #u8(100) #t)
(with-output-to-file tmp-file-path-2
(lambda ()
(values
(write-char #\a)
(write-u8 98)
(write-string "c")
(write-bytevector #u8(100))
)))
=> #values(#void #void #void #void)
(with-input-from-file tmp-file-path-2
(lambda ()
(values
(read-char)
(read-u8)
(read-string 1)
(read-bytevector 1)
(eof-object? (read-u8))
)))
=> #values(#\a 98 "c" #u8(100) #t)
(file-exists? tmp-file-path-1) => #t
(file-exists? tmp-file-path-2) => #t
(delete-file tmp-file-path-1) => #void
(delete-file tmp-file-path-2) => #void
(file-exists? tmp-file-path-1) => #f
(file-exists? tmp-file-path-2) => #f