File: main.ml

package info (click to toggle)
ocaml-obuild 0.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,456 kB
  • sloc: ml: 14,491; sh: 211; ansic: 34; makefile: 11
file content (35 lines) | stat: -rw-r--r-- 1,098 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(* Test for pattern-based generate blocks *)

let () =
  (* List all embedded files *)
  Printf.printf "Embedded files:\n";
  List.iter (fun name ->
    Printf.printf "  - %s\n" name
  ) (Assets.list ());

  (* Print contents of each file *)
  Printf.printf "\nContents:\n";
  List.iter (fun name ->
    match Assets.get name with
    | Some content -> Printf.printf "%s: %s\n" name content
    | None -> Printf.printf "%s: <not found>\n" name
  ) (Assets.list ());

  (* Verify expected files are present *)
  let expected = ["hello.txt"; "greeting.txt"; "info.txt"] in
  let all_present = List.for_all (fun name ->
    match Assets.get name with
    | Some _ -> true
    | None ->
        Printf.printf "ERROR: Missing expected file: %s\n" name;
        false
  ) expected in

  if all_present && List.length (Assets.list ()) = 3 then begin
    Printf.printf "\nSUCCESS: All %d files embedded correctly!\n" (List.length expected);
    exit 0
  end else begin
    Printf.printf "\nFAILURE: Expected %d files, got %d\n"
      (List.length expected) (List.length (Assets.list ()));
    exit 1
  end