File: stubs_reader.test

package info (click to toggle)
critcl 3.3.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,680 kB
  • sloc: ansic: 41,058; tcl: 12,090; sh: 7,230; pascal: 3,456; asm: 3,058; ada: 1,681; cpp: 1,001; cs: 879; makefile: 333; perl: 104; xml: 95; f90: 10
file content (222 lines) | stat: -rw-r--r-- 5,299 bytes parent folder | download
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# stubs_reader.test -*- tcl -*-

# -------------------------------------------------------------------------

source [file join [file dirname [info script]] support testutilities.tcl]

testsNeedTcl     8.6 9
testsNeedTcltest 2

support {
    useLocal lib/stubs_container/container.tcl stubs::container
}
testing {
    useLocal lib/stubs_reader/reader.tcl stubs::reader
}

# -------------------------------------------------------------------------
# file

test stubs-reader-1.0 {file, wrong\#args} -setup {
} -body {
    stubs::reader::file
} -cleanup {
} -returnCodes error -result {wrong # args: should be "stubs::reader::file tablevar path"}

test stubs-reader-1.1 {file, wrong\#args} -setup {
} -body {
    stubs::reader::file T
} -cleanup {
} -returnCodes error -result {wrong # args: should be "stubs::reader::file tablevar path"}

test stubs-reader-1.2 {file, wrong\#args} -setup {
} -body {
    stubs::reader::file T x y
} -cleanup {
} -returnCodes error -result {wrong # args: should be "stubs::reader::file tablevar path"}

# -------------------------------------------------------------------------
# text

test stubs-reader-2.0 {text, wrong\#args} -setup {
} -body {
    stubs::reader::text
} -cleanup {
} -returnCodes error -result {wrong # args: should be "stubs::reader::text tablevar text"}

test stubs-reader-2.1 {text, wrong\#args} -setup {
} -body {
    stubs::reader::text T
} -cleanup {
} -returnCodes error -result {wrong # args: should be "stubs::reader::text tablevar text"}

test stubs-reader-2.2 {text, wrong\#args} -setup {
} -body {
    stubs::reader::text T x y
} -cleanup {
} -returnCodes error -result {wrong # args: should be "stubs::reader::text tablevar text"}

# -------------------------------------------------------------------------
## Representation overview for lots of declarations.

test stubs-reader-3.0 {text, empty} -setup {
    set T [stubs::container::new]
} -body {
    stubs::reader::text T {}
    stubs::container::print $T
} -cleanup {
    unset T
} -result {stubs UNKNOWN {
    scspec   EXTERN
    epoch    {}
    revision 0
}}

test stubs-reader-3.1 {text, basic types} -setup {
    set T [stubs::container::new]
} -body {
    stubs::reader::text T {
        library buf
        interface buf
        hooks {bufInt memchan}
        declare 0 generic {
            int Buf_IsInitialized (Tcl_Interp *interp)
        }
    }
    stubs::container::print $T
} -cleanup {
    unset T
} -result {stubs buf {
    scspec   EXTERN
    epoch    {}
    revision 1
    interface buf {
        hooks {bufInt memchan}
        declare 0 generic {
            function Buf_IsInitialized
            return int
            argument {{Tcl_Interp *} interp}
        }
    }
}}

test stubs-reader-3.2 {text, void} -setup {
    set T [stubs::container::new]
} -body {
    stubs::reader::text T {
        library buf
        interface buf
        hooks {bufInt memchan}
        declare 0 generic {
            int Buf_IsInitialized (void)
        }
    }
    stubs::container::print $T
} -cleanup {
    unset T
} -result {stubs buf {
    scspec   EXTERN
    epoch    {}
    revision 1
    interface buf {
        hooks {bufInt memchan}
        declare 0 generic {
            function Buf_IsInitialized
            return int
            argument void
        }
    }
}}

test stubs-reader-3.3 {text, void via missing arguments} -setup {
    set T [stubs::container::new]
} -body {
    stubs::reader::text T {
        library buf
        interface buf
        hooks {bufInt memchan}
        declare 0 generic {
            int Buf_IsInitialized ()
        }
    }
    stubs::container::print $T
} -cleanup {
    unset T
} -result {stubs buf {
    scspec   EXTERN
    epoch    {}
    revision 1
    interface buf {
        hooks {bufInt memchan}
        declare 0 generic {
            function Buf_IsInitialized
            return int
            argument void
        }
    }
}}

test stubs-reader-3.4 {text, var-args function} -setup {
    set T [stubs::container::new]
} -body {
    stubs::reader::text T {
        library tcl
        interface tcl
        declare 2 {
            void Tcl_Panic(const char *format, ...)
        }
    }
    stubs::container::print $T
} -cleanup {
    unset T
} -result {stubs tcl {
    scspec   EXTERN
    epoch    {}
    revision 1
    interface tcl {
        hooks {}
        declare 2 generic {
            function Tcl_Panic
            return void
            argument TCL_VARARGS
            argument {{const char *} format}
        }
    }
}}

test stubs-reader-3.5 {text, array-flag} -setup {
    set T [stubs::container::new]
} -body {
    stubs::reader::text T {
        library tcl
        interface tcl
	declare 17 {
	    Tcl_Obj *Tcl_ConcatObj(Tcl_Size objc, Tcl_Obj *const objv[])
	}
    }
    stubs::container::print $T
} -cleanup {
    unset T
} -result {stubs tcl {
    scspec   EXTERN
    epoch    {}
    revision 1
    interface tcl {
        hooks {}
        declare 17 generic {
            function Tcl_ConcatObj
            return {Tcl_Obj *}
            argument {Tcl_Size objc}
            argument {{Tcl_Obj *const} objv {[]}}
        }
    }
}}

# -------------------------------------------------------------------------

testsuiteCleanup

# Local variables:
# mode: tcl
# indent-tabs-mode: nil
# End: