]> Repositorios git - scryer-prolog.git/commitdiff
add a test for with_locals
authorSkgland <[email protected]>
Sat, 9 Aug 2025 21:04:13 +0000 (23:04 +0200)
committerBennet Bleßmann <[email protected]>
Sun, 24 Aug 2025 17:56:24 +0000 (19:56 +0200)
tests-pl/ffi_locals.pl [new file with mode: 0644]
tests/scryer/cli/src_tests/ffi_locals.md [new file with mode: 0644]

diff --git a/tests-pl/ffi_locals.pl b/tests-pl/ffi_locals.pl
new file mode 100644 (file)
index 0000000..abd83dc
--- /dev/null
@@ -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 (file)
index 0000000..1925e23
--- /dev/null
@@ -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
+
+```