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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [tests/] [library/] [CaseData.tcl] - Blame information for rev 1782

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

Line No. Rev Author Line
1 578 markom
# CaseData.tcl --
2
#
3
#       Contains data for test cases
4
#
5
# Copyright (c) 1996, Expert Interface Technologies
6
#
7
# See the file "license.terms" for information on usage and redistribution
8
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
9
#
10
 
11
# GetHomeDirs --
12
#
13
#       Returns a list of user names (prefixed with tilde) and their
14
#       home directories
15
#
16
proc GetHomeDirs {} {
17
    set tryList {root ftp admin operator uucp adm man john ioi}
18
    if [catch {
19
        lappend tryList [exec whoami]
20
    }] {
21
        catch {
22
            lappend tryList [exec logname]
23
        }
24
    }
25
 
26
 
27
    set list {}
28
    foreach user $tryList {
29
        if [info exists done($user)] {
30
            continue
31
        }
32
        set expanded [tixFile tilde ~$user]
33
        if ![tixStrEq $expanded ~$user] {
34
            lappend list [list ~$user $expanded]
35
        }
36
        set done($user) 1
37
    }
38
    return $list
39
}
40
 
41
# GetCases_FsNormDir --
42
#
43
#       Returns a set of test cases for verifying whether a non-normalized
44
#       directory is properly notmalized
45
#
46
proc GetCases_FsNormDir {} {
47
 
48
    if [tixStrEq [tix platform] unix] {
49
        #   PATHNAME to TEST            expected result   Causes error for
50
        #                                                   tixFSNormDir?
51
        #----------------------------------------------------------------
52
        set list {
53
            {.                                  ""              1}
54
            {foo                                ""              1}
55
            {~nosuchuser                        ""              1}
56
            {~nosuchuser/../                    ""              1}
57
            {/                                  /               0}
58
            {///                                /               0}
59
            {/./                                /               0}
60
            {/./.                               /               0}
61
            {/./.                               /               0}
62
            {/././.././../                      /               0}
63
            {/etc                               /etc            0}
64
            {/etc/../etc                        /etc            0}
65
            {/etc/../etc/./                     /etc            0}
66
            {/etc/../etc/./                     /etc            0}
67
            {/etc/../usr/./lib                  /usr/lib        0}
68
        }
69
        foreach userInfo [GetHomeDirs] {
70
            lappend list [list [lindex $userInfo 0] [lindex $userInfo 1] 0]
71
        }
72
    } else {
73
        set list [list \
74
            [list .                             ""                      1] \
75
            [list foo                           ""                      1] \
76
            [list ..                            ""                      1] \
77
            [list ..\\foo                       ""                      1] \
78
            [list ..\\dat\\.                    ""                      1] \
79
            [list C:                            ""                      1] \
80
            [list C:\\                          C:                      0] \
81
            [list c:\\                          C:                      0] \
82
            [list C:\\\\                        C:                      0] \
83
            [list C:\\                          C:                      0] \
84
            [list C:\\.                         C:                      0] \
85
            [list C:\\Windows                   C:\\Windows             0] \
86
            [list C:\\Windows\\System           C:\\Windows\\System     0] \
87
            [list C:\\Windows\\..               C:                      0] \
88
        ]
89
    }
90
 
91
    return $list
92
}
93
 
94
# GetCases_FSNorm --
95
#
96
#       Returns a set of test cases for testing the tixFSNorm command.
97
#
98
proc GetCases_FSNorm {} {
99
    global tixPriv
100
 
101
    if [tixStrEq [tix platform] unix] {
102
        #   PATHNAME to TEST            context    <----------  Expected Result ----------------------------------->
103
        #                                              path            vpath(todo)     files(todo)   patterns(todo)
104
        #----------------------------------------------------------------
105
        set list {
106
            {.                          /               /               }
107
            {./                         /               /               }
108
            {./////./                   /               /               }
109
            {..                         /               /               }
110
            {../                        /               /               }
111
            {../..                      /               /               }
112
            {../../../                  /               /               }
113
            {/etc                       /               /etc            }
114
            {/etc///../etc///           /               /etc            }
115
            {/etc///../etc///..         /               /               }
116
            {/etc///../etc///../        /               /               }
117
            {/etc/.                     /               /etc            }
118
            {/./etc/.                   /               /etc            }
119
            {/./././etc/.               /               /etc            }
120
            {/usr/./././local/./lib//// /               /usr/local/lib  }
121
            {./././././etc/             /               /etc            }
122
            {/etc/../etc                /               /etc            }
123
            {/etc/../etc/../etc         /               /etc            }
124
            {/etc/../etc/../            /               /               }
125
            {~foobar/foo                /               /~foobar        }
126
            {~foobar/foo/               /               /~foobar/foo    }
127
        }
128
    } else {
129
        set p $tixPriv(WinPrefix)
130
 
131
        set list [list \
132
            [list .                     $p\\C:          $p\\C:                  ] \
133
            [list .\\.                  $p\\C:          $p\\C:                  ] \
134
            [list .\\Windows            $p\\C:          $p\\C:\\Windows         ] \
135
            [list .\\Windows\\..\\      $p\\C:          $p\\C:                  ] \
136
            [list tmp\\                 $p\\C:          $p\\C:\\tmp             ] \
137
            [list "no such file"        $p\\C:          $p\\C:                  ] \
138
            [list "autoexec.bat"        $p\\C:          $p\\C:                  ] \
139
            [list "ignore/slash\\dd"    $p\\C:          $p\\C:\\ignore/slash    ] \
140
            [list "has space\\"         $p\\C:          "$p\\C:\\has space"     ] \
141
            [list "has space"           $p\\C:          "$p\\C:"                ] \
142
        ]
143
        # ToDo:
144
        #       (1) xx\xx\C: + .. should be xx\xx
145
        #       (2) xx\xx\C: + D: should be xx\xx\D:
146
    }
147
    return $list
148
}

powered by: WebSVN 2.1.0

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