add a test for with_locals

This commit is contained in:
Skgland
2025-08-09 23:04:13 +02:00
committed by Bennet Bleßmann
parent d1356db7e3
commit 3e929511bb
2 changed files with 34 additions and 0 deletions

27
tests-pl/ffi_locals.pl Normal file
View File

@@ -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).

View File

@@ -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
```