authorgravatar for ascottcameron@gmail.comAlex Cameron <ascottcameron@gmail.com> 2020-11-22 18:51:15+11:00
committergravatar for ascottcameron@gmail.comAlex Cameron <ascottcameron@gmail.com> 2020-12-23 01:14:35+11:00
log58bd6c5f8e4b26300dcdd9542881fe148fb51d0c
treec2e63723ccb9012f381056cde4e3213cfe55c962
parent8d6066e09cd9dbdb41f1be5b067bcff5423e2cbc

Add tests for emit-h functionality.


1 files changed, 66 insertions(+), 1 deletions(-)

test/stage2/cbe.zig+66-1
......@@ -19,7 +19,7 @@ pub fn addCases(ctx: *TestContext) !void {
1919 \\}
2020 \\
2121 );
22 ctx.h("Simple header", linux_x64,
22 ctx.h("simple header", linux_x64,
2323 \\export fn start() void{}
2424 ,
2525 \\void start(void);
......@@ -249,4 +249,69 @@ pub fn addCases(ctx: *TestContext) !void {
249249 \\}
250250 \\
251251 );
252 ctx.h("header with single param function", linux_x64,
253 \\export fn start(a: u8) void{}
254 ,
255 \\#include <stdint.h>
256 \\
257 \\void start(uint8_t arg0);
258 \\
259 );
260 ctx.h("header with multiple param function", linux_x64,
261 \\export fn start(a: u8, b: u8, c: u8) void{}
262 ,
263 \\#include <stdint.h>
264 \\
265 \\void start(uint8_t arg0, uint8_t arg1, uint8_t arg2);
266 \\
267 );
268 ctx.h("header with u32 param function", linux_x64,
269 \\export fn start(a: u32) void{}
270 ,
271 \\#include <stdint.h>
272 \\
273 \\void start(uint32_t arg0);
274 \\
275 );
276 ctx.h("header with usize param function", linux_x64,
277 \\export fn start(a: usize) void{}
278 ,
279 \\#include <stddef.h>
280 \\
281 \\void start(size_t arg0);
282 \\
283 );
284 ctx.h("header with bool param function", linux_x64,
285 \\export fn start(a: bool) void{}
286 ,
287 \\void start(bool arg0);
288 \\
289 );
290 ctx.h("header with noreturn function", linux_x64,
291 \\export fn start() noreturn {
292 \\ unreachable;
293 \\}
294 ,
295 \\zig_noreturn void start(void);
296 \\
297 );
298 ctx.h("header with multiple functions", linux_x64,
299 \\export fn a() void{}
300 \\export fn b() void{}
301 \\export fn c() void{}
302 ,
303 \\void a(void);
304 \\void b(void);
305 \\void c(void);
306 \\
307 );
308 ctx.h("header with multiple includes", linux_x64,
309 \\export fn start(a: u32, b: usize) void{}
310 ,
311 \\#include <stddef.h>
312 \\#include <stdint.h>
313 \\
314 \\void start(uint32_t arg0, size_t arg1);
315 \\
316 );
252317}