Skip to content

Commit

Permalink
Merge branch 'mr/update_driver' into 'master'
Browse files Browse the repository at this point in the history
Adjust JSON comparison in unparse driver

See merge request eng/libadalang/libadalang!1637
  • Loading branch information
Nikokrock committed May 8, 2024
2 parents 300bb9a + d68e79e commit 345558a
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions testsuite/drivers/unparser_driver.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import json
import os.path

from drivers.base_driver import BaseDriver
Expand Down Expand Up @@ -52,16 +53,25 @@ def read_file(filename: str) -> str:
return f.read()

document_baseline_filename = self.test_dir(
self.document_baseline_filename
self.document_baseline_filename)
document_baseline = json.dumps(
json.loads(read_file(document_baseline_filename)),
indent=2,
sort_keys=True,
)
document_actual = json.dumps(
json.loads(read_file(self.working_dir("doc.json"))),
indent=2,
sort_keys=True,
)

result.extend(
self.compute_diff(
baseline_file=document_baseline_filename,
baseline=document_baseline,
actual=document_actual,
failure_message="Prettier document mismatch",
)
)
document_baseline = read_file(document_baseline_filename)
document_actual = read_file(self.working_dir("doc.json"))

result.extend(self.compute_diff(
baseline_file=document_baseline_filename,
baseline=document_baseline,
actual=document_actual,
failure_message="Prettier document mismatch",
))

return result

0 comments on commit 345558a

Please sign in to comment.