Fix last 2 foreign-type-checking tests: ListRef match + #t→true

- run_tests.ml: foreign-check-args binding now matches ListRef (from
  the list primitive) in addition to List
- test-foreign.sx: replace #t with true in guard clauses — SX parser
  treats #t as a symbol, not a boolean

2800/2800 tests, zero failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-05 19:49:37 +00:00
parent 1d68f20a37
commit 67ae88b87f
2 changed files with 8 additions and 3 deletions

View File

@@ -636,7 +636,12 @@ let make_test_env () =
bind "foreign-names" (fun _args -> Sx_ref.foreign_names ());
bind "foreign-register!" (fun args -> match args with [String n; spec] -> Sx_ref.foreign_register_b (String n) spec | _ -> Nil);
bind "foreign-resolve-binding" (fun args -> match args with [String s] -> Sx_ref.foreign_resolve_binding (String s) | _ -> Nil);
bind "foreign-check-args" (fun args -> match args with [String n; List p; List a] -> Sx_ref.foreign_check_args (String n) (List p) (List a) | _ -> Nil);
bind "foreign-check-args" (fun args ->
let to_list = function List l -> List l | ListRef r -> List !r | v -> v in
match args with
| [String n; (List _ | ListRef _ as p); (List _ | ListRef _ as a)] ->
Sx_ref.foreign_check_args (String n) (to_list p) (to_list a)
| _ -> Nil);
bind "foreign-build-lambda" (fun args -> match args with [spec] -> Sx_ref.foreign_build_lambda spec | _ -> Nil);
(* Initialize CEK call forward ref — needed by with-capabilities and foreign-dispatch *)

View File

@@ -165,7 +165,7 @@
(deftest
"foreign-check-args rejects wrong type"
(let
((err (guard (e (#t (error-message e))) (foreign-check-args "test" (list {:type "number" :name "x"}) (list "not-a-number")) nil)))
((err (guard (e (true (error-message e))) (foreign-check-args "test" (list {:type "number" :name "x"}) (list "not-a-number")) nil)))
(assert (contains? err "expected number"))))
(deftest
"foreign-check-args accepts any type"
@@ -175,5 +175,5 @@
(deftest
"foreign-check-args rejects too few args"
(let
((err (guard (e (#t (error-message e))) (foreign-check-args "test" (list {:type "number" :name "x"} {:type "number" :name "y"}) (list 1)) nil)))
((err (guard (e (true (error-message e))) (foreign-check-args "test" (list {:type "number" :name "x"} {:type "number" :name "y"}) (list 1)) nil)))
(assert (contains? err "expected 2 args")))))