Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions check-grammar-crate.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"""

import argparse
import filecmp
import pathlib
import subprocess
import sys
Expand Down Expand Up @@ -199,9 +200,15 @@ def compare_metrics(args: argparse.Namespace) -> None:
# Create compare directory
compare_dir.mkdir(parents=True, exist_ok=True)

# Get JSON differences and minimal tests
# Get JSON differences and minimal tests.
# Pair the files by their relative path: given two directories,
# json-minimal-tests walks them in parallel, so it compares unrelated files
# sharing the same name and skips most of the others.
print("\nSave minimal tests in", compare_dir)
run_subprocess("json-minimal-tests", "-o", compare_dir, old_dir, new_dir)
for old_file in sorted(old_dir.rglob("*.json")):
new_file = new_dir / old_file.relative_to(old_dir)
if new_file.is_file() and not filecmp.cmp(old_file, new_file, shallow=False):
run_subprocess("json-minimal-tests", "-o", compare_dir, old_file, new_file)


def main() -> None:
Expand Down