···271271(* ---- xattr tests ---- *)
272272273273(* Helper: build a minimal SquashFS image using the writer *)
274274-let make_image f =
274274+let image f =
275275 let fs = Squashfs.Writer.v () in
276276 f fs;
277277 match Squashfs.of_string (Squashfs.Writer.finalize fs) with
···281281(* has_xattrs returns false for a plain image (no xattr table) *)
282282let test_has_xattrs_false () =
283283 let t =
284284- make_image (fun fs ->
285285- Squashfs.Writer.add_file fs "hello.txt" ~mode:0o644 "hi")
284284+ image (fun fs -> Squashfs.Writer.add_file fs "hello.txt" ~mode:0o644 "hi")
286285 in
287286 Alcotest.(check bool) "no xattrs" false (Squashfs.has_xattrs t)
288287289288(* xattr returns Ok None for inode with no xattrs (xattr_id = 0xFFFFFFFF) *)
290289let test_xattr_no_xattr_table () =
291290 let t =
292292- make_image (fun fs -> Squashfs.Writer.add_file fs "f" ~mode:0o644 "data")
291291+ image (fun fs -> Squashfs.Writer.add_file fs "f" ~mode:0o644 "data")
293292 in
294293 let root = Squashfs.root t in
295294 match Squashfs.xattr t root "user.foo" with
···299298300299(* list_xattrs returns Ok [] for inode with no xattrs *)
301300let test_list_xattrs_empty () =
302302- let t =
303303- make_image (fun fs -> Squashfs.Writer.add_directory fs "d" ~mode:0o755)
304304- in
301301+ let t = image (fun fs -> Squashfs.Writer.add_directory fs "d" ~mode:0o755) in
305302 let root = Squashfs.root t in
306303 match Squashfs.list_xattrs t root with
307304 | Ok [] -> ()
···311308(* xattr on a symlink inode with no xattrs returns Ok None *)
312309let test_xattr_symlink_no_xattrs () =
313310 let t =
314314- make_image (fun fs ->
311311+ image (fun fs ->
315312 Squashfs.Writer.add_file fs "target" ~mode:0o644 "x";
316313 Squashfs.Writer.add_symlink fs "link" "target")
317314 in
···494491let test_xattr_bad_table_start () =
495492 (* A valid image normally has xattr_table_start = 0xFFFFFFFFFFFFFFFF (no xattrs).
496493 We can't easily craft one with a bad table, but we can test the has_xattrs path. *)
497497- let t =
498498- make_image (fun fs -> Squashfs.Writer.add_file fs "f" ~mode:0o644 "x")
499499- in
494494+ let t = image (fun fs -> Squashfs.Writer.add_file fs "f" ~mode:0o644 "x") in
500495 (* has_xattrs is false for writer-generated images *)
501496 Alcotest.(check bool) "has_xattrs false" false (Squashfs.has_xattrs t);
502497 (* xattr on root (no xattr_id) is Ok None *)