~ubuntu-branches/ubuntu/utopic/critcl/utopic

« back to all changes in this revision

Viewing changes to test/stubs_reader.test

  • Committer: Package Import Robot
  • Author(s): Andrew Shadura
  • Date: 2013-05-11 00:08:06 UTC
  • Revision ID: package-import@ubuntu.com-20130511000806-7hq1zc3fnn0gat79
Tags: upstream-3.1.9
ImportĀ upstreamĀ versionĀ 3.1.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# stubs_reader.test -*- tcl -*-
 
2
#
 
3
# $Id: stubs::reader.test,v 1.8 2010/07/06 19:39:00 andreas_kupries Exp $
 
4
 
 
5
# -------------------------------------------------------------------------
 
6
 
 
7
source [file join \
 
8
            [file dirname [file join [pwd] [info script]]] \
 
9
            testutilities.tcl]
 
10
 
 
11
testsNeedTcl     8.4
 
12
testsNeedTcltest 2
 
13
 
 
14
support {
 
15
    useLocal lib/util84/lassign.tcl  lassign84
 
16
    useLocal lib/util84/dict.tcl     dict84
 
17
 
 
18
    useLocal lib/stubs/container.tcl stubs::container
 
19
}
 
20
testing {
 
21
    useLocal lib/stubs/reader.tcl stubs::reader
 
22
}
 
23
 
 
24
# -------------------------------------------------------------------------
 
25
# file
 
26
 
 
27
test stubs-reader-1.0 {file, wrong\#args} -setup {
 
28
} -body {
 
29
    stubs::reader::file
 
30
} -cleanup {
 
31
} -returnCodes error -result {wrong # args: should be "stubs::reader::file tablevar path"}
 
32
 
 
33
test stubs-reader-1.1 {file, wrong\#args} -setup {
 
34
} -body {
 
35
    stubs::reader::file T
 
36
} -cleanup {
 
37
} -returnCodes error -result {wrong # args: should be "stubs::reader::file tablevar path"}
 
38
 
 
39
test stubs-reader-1.2 {file, wrong\#args} -setup {
 
40
} -body {
 
41
    stubs::reader::file T x y
 
42
} -cleanup {
 
43
} -returnCodes error -result {wrong # args: should be "stubs::reader::file tablevar path"}
 
44
 
 
45
# -------------------------------------------------------------------------
 
46
# text
 
47
 
 
48
test stubs-reader-2.0 {text, wrong\#args} -setup {
 
49
} -body {
 
50
    stubs::reader::text
 
51
} -cleanup {
 
52
} -returnCodes error -result {wrong # args: should be "stubs::reader::text tablevar text"}
 
53
 
 
54
test stubs-reader-2.1 {text, wrong\#args} -setup {
 
55
} -body {
 
56
    stubs::reader::text T
 
57
} -cleanup {
 
58
} -returnCodes error -result {wrong # args: should be "stubs::reader::text tablevar text"}
 
59
 
 
60
test stubs-reader-2.2 {text, wrong\#args} -setup {
 
61
} -body {
 
62
    stubs::reader::text T x y
 
63
} -cleanup {
 
64
} -returnCodes error -result {wrong # args: should be "stubs::reader::text tablevar text"}
 
65
 
 
66
# -------------------------------------------------------------------------
 
67
## Representation overview for lots of declarations.
 
68
 
 
69
test stubs-reader-3.0 {text, empty} -setup {
 
70
    set T [stubs::container::new]
 
71
} -body {
 
72
    stubs::reader::text T {}
 
73
    stubs::container::print $T
 
74
} -cleanup {
 
75
    unset T
 
76
} -result {stubs UNKNOWN {
 
77
    scspec   EXTERN
 
78
    epoch    {}
 
79
    revision 0
 
80
}}
 
81
 
 
82
test stubs-reader-3.1 {text, basic types} -setup {
 
83
    set T [stubs::container::new]
 
84
} -body {
 
85
    stubs::reader::text T {
 
86
        library buf
 
87
        interface buf
 
88
        hooks {bufInt memchan}
 
89
        declare 0 generic {
 
90
            int Buf_IsInitialized (Tcl_Interp *interp)
 
91
        }
 
92
    }
 
93
    stubs::container::print $T
 
94
} -cleanup {
 
95
    unset T
 
96
} -result {stubs buf {
 
97
    scspec   EXTERN
 
98
    epoch    {}
 
99
    revision 1
 
100
    interface buf {
 
101
        hooks {bufInt memchan}
 
102
        declare 0 generic {
 
103
            function Buf_IsInitialized
 
104
            return int
 
105
            argument {{Tcl_Interp *} interp}
 
106
        }
 
107
    }
 
108
}}
 
109
 
 
110
test stubs-reader-3.2 {text, void} -setup {
 
111
    set T [stubs::container::new]
 
112
} -body {
 
113
    stubs::reader::text T {
 
114
        library buf
 
115
        interface buf
 
116
        hooks {bufInt memchan}
 
117
        declare 0 generic {
 
118
            int Buf_IsInitialized (void)
 
119
        }
 
120
    }
 
121
    stubs::container::print $T
 
122
} -cleanup {
 
123
    unset T
 
124
} -result {stubs buf {
 
125
    scspec   EXTERN
 
126
    epoch    {}
 
127
    revision 1
 
128
    interface buf {
 
129
        hooks {bufInt memchan}
 
130
        declare 0 generic {
 
131
            function Buf_IsInitialized
 
132
            return int
 
133
            argument void
 
134
        }
 
135
    }
 
136
}}
 
137
 
 
138
test stubs-reader-3.3 {text, void via missing arguments} -setup {
 
139
    set T [stubs::container::new]
 
140
} -body {
 
141
    stubs::reader::text T {
 
142
        library buf
 
143
        interface buf
 
144
        hooks {bufInt memchan}
 
145
        declare 0 generic {
 
146
            int Buf_IsInitialized ()
 
147
        }
 
148
    }
 
149
    stubs::container::print $T
 
150
} -cleanup {
 
151
    unset T
 
152
} -result {stubs buf {
 
153
    scspec   EXTERN
 
154
    epoch    {}
 
155
    revision 1
 
156
    interface buf {
 
157
        hooks {bufInt memchan}
 
158
        declare 0 generic {
 
159
            function Buf_IsInitialized
 
160
            return int
 
161
            argument void
 
162
        }
 
163
    }
 
164
}}
 
165
 
 
166
test stubs-reader-3.4 {text, var-args function} -setup {
 
167
    set T [stubs::container::new]
 
168
} -body {
 
169
    stubs::reader::text T {
 
170
        library tcl
 
171
        interface tcl
 
172
        declare 2 {
 
173
            void Tcl_Panic(const char *format, ...)
 
174
        }
 
175
    }
 
176
    stubs::container::print $T
 
177
} -cleanup {
 
178
    unset T
 
179
} -result {stubs tcl {
 
180
    scspec   EXTERN
 
181
    epoch    {}
 
182
    revision 1
 
183
    interface tcl {
 
184
        hooks {}
 
185
        declare 2 generic {
 
186
            function Tcl_Panic
 
187
            return void
 
188
            argument TCL_VARARGS
 
189
            argument {{const char *} format}
 
190
        }
 
191
    }
 
192
}}
 
193
 
 
194
test stubs-reader-3.5 {text, array-flag} -setup {
 
195
    set T [stubs::container::new]
 
196
} -body {
 
197
    stubs::reader::text T {
 
198
        library tcl
 
199
        interface tcl
 
200
        declare 17 {
 
201
            Tcl_Obj *Tcl_ConcatObj(int objc, Tcl_Obj *const objv[])
 
202
        }
 
203
    }
 
204
    stubs::container::print $T
 
205
} -cleanup {
 
206
    unset T
 
207
} -result {stubs tcl {
 
208
    scspec   EXTERN
 
209
    epoch    {}
 
210
    revision 1
 
211
    interface tcl {
 
212
        hooks {}
 
213
        declare 17 generic {
 
214
            function Tcl_ConcatObj
 
215
            return {Tcl_Obj *}
 
216
            argument {int objc}
 
217
            argument {{Tcl_Obj *const} objv {[]}}
 
218
        }
 
219
    }
 
220
}}
 
221
 
 
222
# -------------------------------------------------------------------------
 
223
 
 
224
testsuiteCleanup
 
225
 
 
226
# Local variables:
 
227
# mode: tcl
 
228
# indent-tabs-mode: nil
 
229
# End: