CCSDS File Delivery Protocol (CCSDS 727.0-B-5) for space file transfer
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lint): resolve E616 fail+Fmt.str usage in cbort, cfdp, cookeio, cpio

Replace Alcotest.fail (Fmt.str ...) with Alcotest.failf ... across
34 call sites in test files.

+15 -15
+15 -15
test/test_cfdp.ml
··· 147 147 match parse_header encoded with 148 148 | Ok (decoded, _cfg, _consumed) -> 149 149 Alcotest.(check header) "roundtrip" original decoded 150 - | Error e -> Alcotest.fail (Fmt.str "decode failed: %a" Cfdp.pp_error e) 150 + | Error e -> Alcotest.failf "decode failed: %a" Cfdp.pp_error e 151 151 152 152 let test_header_file_data () = 153 153 let cfg = Cfdp.default_config in ··· 171 171 match parse_header encoded with 172 172 | Ok (decoded, _cfg, _consumed) -> 173 173 Alcotest.(check header) "file data header" original decoded 174 - | Error e -> Alcotest.fail (Fmt.str "decode failed: %a" Cfdp.pp_error e) 174 + | Error e -> Alcotest.failf "decode failed: %a" Cfdp.pp_error e 175 175 176 176 let test_header_truncated () = 177 177 let buf = String.make 2 '\x00' in ··· 180 180 let buf = Bytes.to_string buf in 181 181 match parse_header buf with 182 182 | Error (Cfdp.Truncated _) -> () 183 - | Error e -> Alcotest.fail (Fmt.str "wrong error: %a" Cfdp.pp_error e) 183 + | Error e -> Alcotest.failf "wrong error: %a" Cfdp.pp_error e 184 184 | _ -> Alcotest.fail "should reject truncated header" 185 185 186 186 (* {1 Directive Tests} *) ··· 195 195 Alcotest.(check int32) "checksum" original.checksum decoded.checksum; 196 196 Alcotest.(check int64) "file_size" original.file_size decoded.file_size 197 197 | Ok _ -> Alcotest.fail "wrong directive type" 198 - | Error e -> Alcotest.fail (Fmt.str "parse failed: %a" Cfdp.pp_error e) 198 + | Error e -> Alcotest.failf "parse failed: %a" Cfdp.pp_error e 199 199 200 200 let test_eof_with_fault () = 201 201 let original = ··· 216 216 (Cfdp.Entity_id.to_int64 eid) 217 217 | None -> Alcotest.fail "expected fault location") 218 218 | Ok _ -> Alcotest.fail "wrong directive type" 219 - | Error e -> Alcotest.fail (Fmt.str "parse failed: %a" Cfdp.pp_error e) 219 + | Error e -> Alcotest.failf "parse failed: %a" Cfdp.pp_error e 220 220 221 221 let test_metadata_roundtrip () = 222 222 let original = ··· 234 234 "src" original.source_filename decoded.source_filename; 235 235 Alcotest.(check string) "dst" original.dest_filename decoded.dest_filename 236 236 | Ok _ -> Alcotest.fail "wrong directive type" 237 - | Error e -> Alcotest.fail (Fmt.str "parse failed: %a" Cfdp.pp_error e) 237 + | Error e -> Alcotest.failf "parse failed: %a" Cfdp.pp_error e 238 238 239 239 let test_finished_roundtrip () = 240 240 let original = ··· 253 253 (decoded.file_status = Cfdp.Retained_successfully) 254 254 true 255 255 | Ok _ -> Alcotest.fail "wrong directive type" 256 - | Error e -> Alcotest.fail (Fmt.str "parse failed: %a" Cfdp.pp_error e) 256 + | Error e -> Alcotest.failf "parse failed: %a" Cfdp.pp_error e 257 257 258 258 let test_ack_roundtrip () = 259 259 let original = ··· 269 269 (decoded.transaction_status = Cfdp.Tx_active) 270 270 true 271 271 | Ok _ -> Alcotest.fail "wrong directive type" 272 - | Error e -> Alcotest.fail (Fmt.str "parse failed: %a" Cfdp.pp_error e) 272 + | Error e -> Alcotest.failf "parse failed: %a" Cfdp.pp_error e 273 273 274 274 let test_nak_roundtrip () = 275 275 let original = ··· 284 284 Alcotest.(check int64) "end_scope" original.end_scope decoded.end_scope; 285 285 Alcotest.(check int) "segments" 2 (List.length decoded.segments) 286 286 | Ok _ -> Alcotest.fail "wrong directive type" 287 - | Error e -> Alcotest.fail (Fmt.str "parse failed: %a" Cfdp.pp_error e) 287 + | Error e -> Alcotest.failf "parse failed: %a" Cfdp.pp_error e 288 288 289 289 let test_prompt_roundtrip () = 290 290 let original = Cfdp.prompt Cfdp.Prompt_nak in ··· 293 293 | Ok (Cfdp.Prompt decoded, _) -> 294 294 Alcotest.(check bool) "response" (decoded.response = Cfdp.Prompt_nak) true 295 295 | Ok _ -> Alcotest.fail "wrong directive type" 296 - | Error e -> Alcotest.fail (Fmt.str "parse failed: %a" Cfdp.pp_error e) 296 + | Error e -> Alcotest.failf "parse failed: %a" Cfdp.pp_error e 297 297 298 298 let test_keep_alive_roundtrip () = 299 299 let original = Cfdp.keep_alive 12345L in ··· 302 302 | Ok (Cfdp.Keep_alive decoded, _) -> 303 303 Alcotest.(check int64) "progress" original.progress decoded.progress 304 304 | Ok _ -> Alcotest.fail "wrong directive type" 305 - | Error e -> Alcotest.fail (Fmt.str "parse failed: %a" Cfdp.pp_error e) 305 + | Error e -> Alcotest.failf "parse failed: %a" Cfdp.pp_error e 306 306 307 307 (* {1 File Data Tests} *) 308 308 ··· 320 320 | Ok (decoded, _) -> 321 321 Alcotest.(check int64) "offset" original.offset decoded.offset; 322 322 Alcotest.(check bytes) "data" original.data decoded.data 323 - | Error e -> Alcotest.fail (Fmt.str "parse failed: %a" Cfdp.pp_error e) 323 + | Error e -> Alcotest.failf "parse failed: %a" Cfdp.pp_error e 324 324 325 325 let test_file_data_large_file () = 326 326 let original = ··· 335 335 with 336 336 | Ok (decoded, _) -> 337 337 Alcotest.(check int64) "large offset" original.offset decoded.offset 338 - | Error e -> Alcotest.fail (Fmt.str "parse failed: %a" Cfdp.pp_error e) 338 + | Error e -> Alcotest.failf "parse failed: %a" Cfdp.pp_error e 339 339 340 340 (* {1 Complete PDU Tests} *) 341 341 ··· 367 367 | Ok (Cfdp.Pdu_directive (_, Cfdp.Metadata decoded), _) -> 368 368 Alcotest.(check string) "src" meta.source_filename decoded.source_filename 369 369 | Ok _ -> Alcotest.fail "wrong PDU type" 370 - | Error e -> Alcotest.fail (Fmt.str "parse failed: %a" Cfdp.pp_error e) 370 + | Error e -> Alcotest.failf "parse failed: %a" Cfdp.pp_error e 371 371 372 372 let test_pdu_roundtrip_file_data () = 373 373 let cfg = Cfdp.default_config in ··· 394 394 | Ok (Cfdp.Pdu_file_data (_, decoded), _) -> 395 395 Alcotest.(check bytes) "data" fd.data decoded.data 396 396 | Ok _ -> Alcotest.fail "wrong PDU type" 397 - | Error e -> Alcotest.fail (Fmt.str "parse failed: %a" Cfdp.pp_error e) 397 + | Error e -> Alcotest.failf "parse failed: %a" Cfdp.pp_error e 398 398 399 399 (* {1 Checksum Tests} *) 400 400