From: Skgland Date: Sat, 9 Aug 2025 21:04:13 +0000 (+0200) Subject: add a test for with_locals X-Git-Tag: v0.10.0~11^2~15 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=3e929511bbb010f8478722b238dd00df5d7c218e;p=scryer-prolog.git add a test for with_locals --- diff --git a/tests-pl/ffi_locals.pl b/tests-pl/ffi_locals.pl new file mode 100644 index 00000000..abd83dc0 --- /dev/null +++ b/tests-pl/ffi_locals.pl @@ -0,0 +1,27 @@ +:- use_module(library(ffi)). +:- use_module(library(format)). + +test :- + ffi:array_type(u64, 1, ArrayType1), + ffi:with_locals( + [ + let(_Local1, ArrayType1, [ArrayType1 , 42]) + ], + format("With Locals 1~n", []) + ), + ffi:array_type(u8, 4, ArrayType2), + ffi:with_locals( + [ + let(_Local2, ArrayType2, [ArrayType2 , 42, 13, 4, 12]) + ], + format("With Locals 2~n", []) + ), + ffi:array_type(u64, 1, ArrayType3), + ffi:with_locals( + [ + let(_Local3, ArrayType3, [ArrayType3 , 42]) + ], + format("With Locals 3~n", []) + ). + +:- initialization(test). diff --git a/tests/scryer/cli/src_tests/ffi_locals.md b/tests/scryer/cli/src_tests/ffi_locals.md new file mode 100644 index 00000000..1925e231 --- /dev/null +++ b/tests/scryer/cli/src_tests/ffi_locals.md @@ -0,0 +1,7 @@ +```trycmd +$ scryer-prolog -f --no-add-history tests-pl/ffi_locals.pl -g halt +With Locals 1 +With Locals 2 +With Locals 3 + +```