summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/017/glob-carray.expected2
-rw-r--r--tests/017/glob-carray.tl7
-rw-r--r--tests/017/glob-zarray.tl19
3 files changed, 21 insertions, 7 deletions
diff --git a/tests/017/glob-carray.expected b/tests/017/glob-carray.expected
index cf4b8a5e..996151ee 100644
--- a/tests/017/glob-carray.expected
+++ b/tests/017/glob-carray.expected
@@ -1,4 +1,4 @@
0
-#S(glob-t pathc 5 pathv #<carray 5 #<ffi-type str-d>> reserve 0)
+#S(glob-t pathc 5 pathv #<carray 5 #<ffi-type str>> reserve 0)
#("tests/001/query-1.txr" "tests/001/query-2.txr" "tests/001/query-3.txr"
"tests/001/query-4.txr" "tests/001/query-5.txr")
diff --git a/tests/017/glob-carray.tl b/tests/017/glob-carray.tl
index d40dfdad..99660576 100644
--- a/tests/017/glob-carray.tl
+++ b/tests/017/glob-carray.tl
@@ -10,7 +10,7 @@
(nil int)
(nil size-t)
(nil int)
- (pathv (carray str-d))
+ (pathv (carray str))
(nil (array 4 cptr)))))
((:cygnal :cygwin)
(deffi-type glob-t (struct glob-t
@@ -18,12 +18,13 @@
(nil size-t)
(nil size-t)
(nil int)
- (pathv (carray str-d))
+ (pathv (carray str))
(nil (array 6 cptr)))))
(t (deffi-type glob-t (struct glob-t
(pathc size-t)
- (pathv (carray str-d))
+ (pathv (carray str))
(reserve size-t)
+ (nil int)
(nil (array 5 cptr))))))
(with-dyn-lib (libc)
diff --git a/tests/017/glob-zarray.tl b/tests/017/glob-zarray.tl
index 81d11bf8..b095e45e 100644
--- a/tests/017/glob-zarray.tl
+++ b/tests/017/glob-zarray.tl
@@ -10,7 +10,7 @@
(nil int)
(nil size-t)
(nil int)
- (pathv (ptr-out-d (zarray str-d)))
+ (pathv (ptr-out (zarray str)))
(nil (array 4 cptr)))))
((:cygnal :cygwin)
(deffi-type glob-t (struct glob-t
@@ -18,18 +18,31 @@
(nil size-t)
(nil size-t)
(nil int)
- (pathv (ptr-out-d (zarray str-d)))
+ (pathv (ptr-out (zarray str)))
(nil (array 6 cptr)))))
(t (deffi-type glob-t (struct glob-t
(pathc size-t)
- (pathv (ptr-out-d (zarray str-d)))
+ (pathv (ptr-out (zarray str)))
(reserve size-t)
+ (nil int)
(nil (array 5 cptr))))))
(with-dyn-lib (libc)
(deffi globb "glob" int (str int closure (ptr-out glob-t)))
+ (deffi globfree "globfree" void ((ptr-in glob-t)))
(deffi-cb glob-cb int (str int) -1))
+;; Note: we deliberately don't call (globfree g) in this
+;; test case because it won't reliably work. The problem is
+;; that FFI will create a brand new C struct and populate
+;; the array with newly allocated strings.
+;;
+;; In the glob-carray.tl test case, we do call globfree.
+;; Though a different C struct is allocated, which makes
+;; that usage not strictly correct, that structure is
+;; populated with the original string pointers due to the
+;; carray type being used.
+;;
(let* ((g (new glob-t)))
(prinl (globb "tests/001/*.txr" 0 (glob-cb (lambda (path err))) g))
(prinl g))