X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=test_augeas.ml;h=c47db9a053017a6c3c01f4c8c1fea6b558c9f1a5;hb=refs%2Fheads%2Fmaster;hp=0124b589e5ed572bd60e6374137eb514b13d413c;hpb=d92842594f602cc60b199b7377862a10798dbb7a;p=ocaml-augeas.git diff --git a/test_augeas.ml b/test_augeas.ml index 0124b58..c47db9a 100644 --- a/test_augeas.ml +++ b/test_augeas.ml @@ -20,18 +20,22 @@ let () = let aug = - let loadpath = Some "/usr/share/augeas/lenses" in + let loadpath = None in let flags = [ Augeas.AugSaveBackup ] in Augeas.create "test_root" loadpath flags in - (* Print all files. *) - let files = Augeas.matches aug "/files/*" in - List.iter print_endline files; - - (* Print all Augeas-metainfo. *) - let augs = Augeas.matches aug "/augeas/*" in - List.iter print_endline augs; - + (* Print all files recursively. *) + let rec print path = + if path <> "" then ( + let value = Augeas.get aug path in + match value with + | None -> print_endline path + | Some value -> Printf.printf "%s -> '%s'\n%!" path value + ); + let files = List.sort compare (Augeas.matches aug (path ^ "/*")) in + List.iter print files + in + print ""; (* Run the garbage collector to check for internal errors. *) Gc.compact ()