File: non_ascii_filenames.ml

package info (click to toggle)
js-of-ocaml 6.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 37,932 kB
  • sloc: ml: 135,957; javascript: 58,364; ansic: 437; makefile: 422; sh: 12; perl: 4
file content (27 lines) | stat: -rw-r--r-- 807 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
let test f v =
  try
    ignore (f v);
    Printf.printf "  %s: PASS\n" v
  with Sys_error _ | Not_found | Exit -> Printf.printf "  %s: FAIL\n" v

let () =
  Printf.printf "opening files\n";
  test open_in "/static/accentué";
  test open_in "/static/accentu�";
  test open_in "accentué";
  test open_in "accentu�";
  Printf.printf "reading directories\n";
  let check_file d =
    let a = Sys.readdir d in
    if not (Array.exists (fun x -> x = "accentué") a) then raise Not_found
  in
  test check_file ".";
  test check_file "/static";
  Printf.printf "current working directory\n";
  let test_chdir d =
    Sys.mkdir d 0o777;
    Sys.chdir d;
    if Filename.basename (Sys.getcwd ()) <> "répertoire" then raise Exit
  in
  test test_chdir "./répertoire";
  test test_chdir "/static/répertoire"