]>
git.proxmox.com Git - rustc.git/blob - tests/run-make-fulldeps/rustdoc-map-file/validate_json.py
8 def find_redirect_map_file(folder
, errors
):
9 for root
, dirs
, files
in os
.walk(folder
):
11 if not name
.endswith("redirect-map.json"):
13 with
open(os
.path
.join(root
, name
)) as f
:
15 with
open("expected.json") as f
:
16 expected
= json
.load(f
)
18 if expected
[key
] != data
.get(key
):
19 errors
.append("Expected `{}` for key `{}`, found: `{}`".format(
20 expected
[key
], key
, data
.get(key
)))
24 errors
.append("Extra data not expected: key: `{}`, data: `{}`".format(
30 if len(sys
.argv
) != 2:
31 print("Expected doc directory to check!")
35 if not find_redirect_map_file(sys
.argv
[1], errors
):
36 print("Didn't find the map file in `{}`...".format(sys
.argv
[1]))
39 print("=> {}".format(err
))