Address review comments.
Go back to CRATE_DEF_INDEX Minor niceness improvements Don't output hidden items Remove striped items from fields Add $TEST_BASE_DIR Small catch
This commit is contained in:
parent
1098cce27a
commit
40b5470b0d
9 changed files with 80 additions and 103 deletions
|
|
@ -1,6 +0,0 @@
|
|||
-include ../tools.mk
|
||||
|
||||
tests: *.rs
|
||||
$(RUSTDOC) $< -o $(TMPDIR) --output-format json
|
||||
$(PYTHON) check_missing_items.py $(TMPDIR)/$(basename $<).json
|
||||
$(PYTHON) compare.py $(basename $<).expected $(TMPDIR)/$(basename $<).json
|
||||
|
|
@ -34,23 +34,18 @@ def check_subset(expected_main, actual_main, base_dir):
|
|||
def _check_subset(expected, actual, trace):
|
||||
expected_type = type(expected)
|
||||
actual_type = type(actual)
|
||||
|
||||
if actual_type is str:
|
||||
actual = actual.replace(base_dir, "$TEST_BASE_DIR")
|
||||
|
||||
if expected_type is not actual_type:
|
||||
raise SubsetException(
|
||||
"expected type `{}`, got `{}`".format(expected_type, actual_type), trace
|
||||
)
|
||||
if expected_type in (str, int, bool) and expected != actual:
|
||||
if expected_type == str and actual.startswith(base_dir):
|
||||
if actual.replace(base_dir + "/", "") != expected:
|
||||
raise SubsetException(
|
||||
"expected `{}`, got: `{}`".format(
|
||||
expected, actual.replace(base_dir + "/", "")
|
||||
),
|
||||
trace,
|
||||
)
|
||||
else:
|
||||
raise SubsetException(
|
||||
"expected `{}`, got: `{}`".format(expected, actual), trace
|
||||
)
|
||||
|
||||
|
||||
if expected_type in (int, bool, str) and expected != actual:
|
||||
raise SubsetException("expected `{}`, got: `{}`".format(expected, actual), trace)
|
||||
if expected_type is dict:
|
||||
for key in expected:
|
||||
if key not in actual:
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
"crate_id": 0,
|
||||
"name": "Unit",
|
||||
"source": {
|
||||
"filename": "structs.rs",
|
||||
"filename": "$TEST_BASE_DIR/structs.rs",
|
||||
"begin": [
|
||||
7,
|
||||
0
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
"crate_id": 0,
|
||||
"name": "1",
|
||||
"source": {
|
||||
"filename": "structs.rs",
|
||||
"filename": "$TEST_BASE_DIR/structs.rs",
|
||||
"begin": [
|
||||
5,
|
||||
22
|
||||
|
|
@ -72,7 +72,7 @@
|
|||
"crate_id": 0,
|
||||
"name": "stuff",
|
||||
"source": {
|
||||
"filename": "structs.rs",
|
||||
"filename": "$TEST_BASE_DIR/structs.rs",
|
||||
"begin": [
|
||||
15,
|
||||
4
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
"crate_id": 0,
|
||||
"name": "WithPrimitives",
|
||||
"source": {
|
||||
"filename": "structs.rs",
|
||||
"filename": "$TEST_BASE_DIR/structs.rs",
|
||||
"begin": [
|
||||
9,
|
||||
0
|
||||
|
|
@ -141,18 +141,14 @@
|
|||
],
|
||||
"where_predicates": []
|
||||
},
|
||||
"fields_stripped": true,
|
||||
"fields": [
|
||||
"0:13",
|
||||
"0:14"
|
||||
]
|
||||
"fields_stripped": true
|
||||
}
|
||||
},
|
||||
"0:14": {
|
||||
"crate_id": 0,
|
||||
"name": "s",
|
||||
"source": {
|
||||
"filename": "structs.rs",
|
||||
"filename": "$TEST_BASE_DIR/structs.rs",
|
||||
"begin": [
|
||||
11,
|
||||
4
|
||||
|
|
@ -184,7 +180,7 @@
|
|||
"crate_id": 0,
|
||||
"name": "things",
|
||||
"source": {
|
||||
"filename": "structs.rs",
|
||||
"filename": "$TEST_BASE_DIR/structs.rs",
|
||||
"begin": [
|
||||
16,
|
||||
4
|
||||
|
|
@ -232,7 +228,7 @@
|
|||
"crate_id": 0,
|
||||
"name": "WithGenerics",
|
||||
"source": {
|
||||
"filename": "structs.rs",
|
||||
"filename": "$TEST_BASE_DIR/structs.rs",
|
||||
"begin": [
|
||||
14,
|
||||
0
|
||||
|
|
@ -273,18 +269,14 @@
|
|||
],
|
||||
"where_predicates": []
|
||||
},
|
||||
"fields_stripped": true,
|
||||
"fields": [
|
||||
"0:18",
|
||||
"0:19"
|
||||
]
|
||||
"fields_stripped": true
|
||||
}
|
||||
},
|
||||
"0:0": {
|
||||
"crate_id": 0,
|
||||
"name": "structs",
|
||||
"source": {
|
||||
"filename": "structs.rs",
|
||||
"filename": "$TEST_BASE_DIR/structs.rs",
|
||||
"begin": [
|
||||
1,
|
||||
0
|
||||
|
|
@ -315,7 +307,7 @@
|
|||
"crate_id": 0,
|
||||
"name": "num",
|
||||
"source": {
|
||||
"filename": "structs.rs",
|
||||
"filename": "$TEST_BASE_DIR/structs.rs",
|
||||
"begin": [
|
||||
10,
|
||||
4
|
||||
|
|
@ -340,7 +332,7 @@
|
|||
"crate_id": 0,
|
||||
"name": "Tuple",
|
||||
"source": {
|
||||
"filename": "structs.rs",
|
||||
"filename": "$TEST_BASE_DIR/structs.rs",
|
||||
"begin": [
|
||||
5,
|
||||
0
|
||||
|
|
@ -362,18 +354,14 @@
|
|||
"params": [],
|
||||
"where_predicates": []
|
||||
},
|
||||
"fields_stripped": true,
|
||||
"fields": [
|
||||
"0:7",
|
||||
"0:8"
|
||||
]
|
||||
"fields_stripped": true
|
||||
}
|
||||
},
|
||||
"0:4": {
|
||||
"crate_id": 0,
|
||||
"name": "PlainEmpty",
|
||||
"source": {
|
||||
"filename": "structs.rs",
|
||||
"filename": "$TEST_BASE_DIR/structs.rs",
|
||||
"begin": [
|
||||
3,
|
||||
0
|
||||
|
|
@ -403,7 +391,7 @@
|
|||
"crate_id": 0,
|
||||
"name": "0",
|
||||
"source": {
|
||||
"filename": "structs.rs",
|
||||
"filename": "$TEST_BASE_DIR/structs.rs",
|
||||
"begin": [
|
||||
5,
|
||||
17
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue