OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tcl/] [tests/] [macFCmd.test] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# This file tests the tclfCmd.c file.
2
#
3
# This file contains a collection of tests for one or more of the Tcl
4
# built-in commands.  Sourcing this file into Tcl runs the tests and
5
# generates output for errors.  No output means no errors were found.
6
#
7
# Copyright (c) 1997 Sun Microsystems, Inc.
8
#
9
# See the file "license.terms" for information on usage and redistribution
10
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11
#
12
# RCS: @(#) $Id: macFCmd.test,v 1.1.1.1 2002-01-16 10:25:36 markom Exp $
13
#
14
 
15
if {$tcl_platform(platform) != "macintosh"} {
16
    return
17
}
18
 
19
if {[string compare test [info procs test]] == 1} then {source defs}
20
 
21
catch {file delete -force foo.dir}
22
file mkdir foo.dir
23
if {[catch {file attributes foo.dir -readonly 1}]} {
24
    set testConfig(fileSharing) 0
25
    set testConfig(notFileSharing) 1
26
} else {
27
    set testConfig(fileSharing) 1
28
    set testConfig(notFileSharing) 0
29
}
30
file delete -force foo.dir
31
 
32
test macFCmd-1.1 {GetFileFinderAttributes - no file} {
33
    catch {file delete -force foo.file}
34
    list [catch {file attributes foo.file -creator} msg] $msg
35
} {1 {couldn't get attributes for file ":foo.file": no such file or directory}}
36
test macFCmd-1.2 {GetFileFinderAttributes - creator} {
37
    catch {file delete -force foo.file}
38
    catch {close [open foo.file w]}
39
    list [catch {file attributes foo.file -creator} msg] $msg [file delete -force foo.file]
40
} {0 {MPW } {}}
41
test macFCmd-1.3 {GetFileFinderAttributes - type} {
42
    catch {file delete -force foo.file}
43
    catch {close [open foo.file w]}
44
    list [catch {file attributes foo.file -type} msg] $msg [file delete -force foo.file]
45
} {0 TEXT {}}
46
test macFCmd-1.4 {GetFileFinderAttributes - not hidden} {
47
    catch {file delete -force foo.file}
48
    catch {close [open foo.file w]}
49
    list [catch {file attributes foo.file -hidden} msg] $msg [file delete -force foo.file]
50
} {0 0 {}}
51
test macFCmd-1.5 {GetFileFinderAttributes - hidden} {
52
    catch {file delete -force foo.file}
53
    catch {close [open foo.file w]}
54
    file attributes foo.file -hidden 1
55
    list [catch {file attributes foo.file -hidden} msg] $msg [file delete -force foo.file]
56
} {0 1 {}}
57
test macFCmd-1.6 {GetFileFinderAttributes - folder creator} {
58
    catch {file delete -force foo.dir}
59
    file mkdir foo.dir
60
    list [catch {file attributes foo.dir -creator} msg] $msg [file delete -force foo.dir]
61
} {0 Fldr {}}
62
test macFCmd-1.7 {GetFileFinderAttributes - folder type} {
63
    catch {file delete -force foo.dir}
64
    file mkdir foo.dir
65
    list [catch {file attributes foo.dir -type} msg] $msg [file delete -force foo.dir]
66
} {0 Fldr {}}
67
test macFCmd-1.8 {GetFileFinderAttributes - folder hidden} {
68
    catch {file delete -force foo.dir}
69
    file mkdir foo.dir
70
    list [catch {file attributes foo.dir -hidden} msg] $msg [file delete -force foo.dir]
71
} {0 0 {}}
72
 
73
test macFCmd-2.1 {GetFileReadOnly - bad file} {
74
    catch {file delete -force foo.file}
75
    list [catch {file attributes foo.file -readonly} msg] $msg
76
} {1 {couldn't get attributes for file ":foo.file": no such file or directory}}
77
test macFCmd-2.2 {GetFileReadOnly - file not read only} {
78
    catch {file delete -force foo.file}
79
    close [open foo.file w]
80
    list [catch {file attributes foo.file -readonly} msg] $msg [file delete -force foo.file]
81
} {0 0 {}}
82
test macFCmd-2.3 {GetFileReadOnly - file read only} {
83
    catch {file delete -force foo.file}
84
    close [open foo.file w]
85
    file attributes foo.file -readonly 1
86
    list [catch {file attributes foo.file -readonly} msg] $msg [file delete -force foo.file]
87
} {0 1 {}}
88
test macFCmd-2.4 {GetFileReadOnly - directory not read only} {
89
    catch {file delete -force foo.dir}
90
    file mkdir foo.dir
91
    list [catch {file attributes foo.dir -readonly} msg] $msg [file delete -force foo.dir]
92
} {0 0 {}}
93
test macFCmd-2.5 {GetFileReadOnly - directory read only} {fileSharing} {
94
    catch {file delete -force foo.dir}
95
    file mkdir foo.dir
96
    file attributes foo.dir -readonly 1
97
    list [catch {file attributes foo.dir -readonly} msg] $msg [file delete -force foo.dir]
98
} {0 1 {}}
99
 
100
test macFCmd-3.1 {SetFileFinderAttributes - bad file} {
101
    catch {file delete -force foo.file}
102
    list [catch {file attributes foo.file -creator FOOO} msg] $msg
103
} {1 {couldn't set attributes for file ":foo.file": no such file or directory}}
104
test macFCmd-3.2 {SetFileFinderAttributes - creator} {
105
    catch {file delete -force foo.file}
106
    close [open foo.file w]
107
    list [catch {file attributes foo.file -creator FOOO} msg] $msg [file attributes foo.file -creator] [file delete -force foo.file]
108
} {0 {} FOOO {}}
109
test macFCmd-3.3 {SetFileFinderAttributes - bad creator} {
110
    catch {file delete -force foo.file}
111
    close [open foo.file w]
112
    list [catch {file attributes foo.file -creator 0} msg] $msg [file delete -force foo.file]
113
} {1 {expected Macintosh OS type but got "0"} {}}
114
test macFCmd-3.4 {SetFileFinderAttributes - hidden} {
115
    catch {file delete -force foo.file}
116
    close [open foo.file w]
117
    list [catch {file attributes foo.file -hidden 1} msg] $msg [file attributes foo.file -hidden] [file delete -force foo.file]
118
} {0 {} 1 {}}
119
test macFCmd-3.5 {SetFileFinderAttributes - type} {
120
    catch {file delete -force foo.file}
121
    close [open foo.file w]
122
    list [catch {file attributes foo.file -type FOOO} msg] $msg [file attributes foo.file -type] [file delete -force foo.file]
123
} {0 {} FOOO {}}
124
test macFCmd-3.6 {SetFileFinderAttributes - bad type} {
125
    catch {file delete -force foo.file}
126
    close [open foo.file w]
127
    list [catch {file attributes foo.file -type 0} msg] $msg [file delete -force foo.file]
128
} {1 {expected Macintosh OS type but got "0"} {}}
129
test macFCmd-3.7 {SetFileFinderAttributes - directory} {
130
    catch {file delete -force foo.dir}
131
    file mkdir foo.dir
132
    list [catch {file attributes foo.dir -creator FOOO} msg] $msg [file delete -force foo.dir]
133
} {1 {cannot set -creator: ":foo.dir" is a directory} {}}
134
 
135
test macFCmd-4.1 {SetFileReadOnly - bad file} {
136
    catch {file delete -force foo.file}
137
    list [catch {file attributes foo.file -readonly 1} msg] $msg
138
} {1 {couldn't set attributes for file ":foo.file": no such file or directory}}
139
test macFCmd-4.2 {SetFileReadOnly - file not readonly} {
140
    catch {file delete -force foo.file}
141
    close [open foo.file w]
142
    list [catch {file attributes foo.file -readonly 0} msg] $msg [file attributes foo.file -readonly] [file delete -force foo.file]
143
} {0 {} 0 {}}
144
test macFCmd-4.3 {SetFileReadOnly - file readonly} {
145
    catch {file delete -force foo.file}
146
    close [open foo.file w]
147
    list [catch {file attributes foo.file -readonly 1} msg] $msg [file attributes foo.file -readonly] [file delete -force foo.file]
148
} {0 {} 1 {}}
149
test macFCmd-4.4 {SetFileReadOnly - directory not readonly} {fileSharing} {
150
    catch {file delete -force foo.dir}
151
    file mkdir foo.dir
152
    list [catch {file attributes foo.dir -readonly 0} msg] $msg [file attributes foo.dir -readonly] [file delete -force foo.dir]
153
} {0 {} 0 {}}
154
test macFCmd-4.5 {SetFileReadOnly - directory not readonly} {notFileSharing} {
155
    catch {file delete -force foo.dir}
156
    file mkdir foo.dir
157
    list [catch {file attributes foo.dir -readonly 0} msg] $msg [file delete -force foo.dir]
158
} {1 {cannot set a directory to read-only when File Sharing is turned off} {}}
159
test macFCmd-4.6 {SetFileReadOnly - directory readonly} {fileSharing} {
160
    catch {file delete -force foo.dir}
161
    file mkdir foo.dir
162
    list [catch {file attributes foo.dir -readonly 1} msg] $msg [file attributes foo.dir -readonly] [file delete -force foo.dir]
163
} {0 {} 1 {}}
164
test macFCmd-4.7 {SetFileReadOnly - directory readonly} {notFileSharing} {
165
    catch {file delete -force foo.dir}
166
    file mkdir foo.dir
167
    list [catch {file attributes foo.dir -readonly 1} msg] $msg [file delete -force foo.dir]
168
} {1 {cannot set a directory to read-only when File Sharing is turned off} {}}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.