v2 / vlib / v / tests / c_errno_name_clash_test.c.v
11 lines · 10 sloc · 196 bytes · 2697f9788fd55133a3e9dfc44b27125bf06dd47c
Raw
1#include <errno.h>
2
3fn test_assigning_c_errno_to_same_named_local_var() {
4 old_errno := C.errno
5 defer {
6 C.errno = old_errno
7 }
8 C.errno = C.ENOENT
9 errno := C.errno
10 assert errno == C.ENOENT
11}
12