From 3fbc79ce6f249c527f63763c02ea384e51180f99 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku <kaz@kylheku.com> Date: Sat, 20 May 2017 21:38:50 -0700 Subject: ffi: add two tests based on realpath. The realpath function is called using FFI. One approach passes a null pointer, so that the function dynamically allocates. The return value is str-d, causing FFI to take ownership of the pointer, freeing it. The other approach is to pass a pointer to a large null-terminated character array, marked for ownership transfer to the function. FFI allocates it and puts the argument into it, which is just a dummy empty string. The function fills that buffer and returns it. The return is captured as a str-d, so FFI takes ownership back, and frees the buffer. * tests/017/realpath.tl: New function. * tests/017/realpath.expected: Likewise. --- tests/017/realpath.expected | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/017/realpath.expected (limited to 'tests/017/realpath.expected') diff --git a/tests/017/realpath.expected b/tests/017/realpath.expected new file mode 100644 index 00000000..659aa110 --- /dev/null +++ b/tests/017/realpath.expected @@ -0,0 +1,2 @@ +"/usr/bin" +"/usr/bin" -- cgit v1.2.3