From 3e929511bbb010f8478722b238dd00df5d7c218e Mon Sep 17 00:00:00 2001 From: Skgland Date: Sat, 9 Aug 2025 23:04:13 +0200 Subject: [PATCH] add a test for with_locals --- tests-pl/ffi_locals.pl | 27 ++++++++++++++++++++++++ tests/scryer/cli/src_tests/ffi_locals.md | 7 ++++++ 2 files changed, 34 insertions(+) create mode 100644 tests-pl/ffi_locals.pl create mode 100644 tests/scryer/cli/src_tests/ffi_locals.md 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 + +``` -- 2.54.0