Browse Source

FileAPI test: Add infrastructure for reading JSON test data

Kyle Edwards 5 years ago
parent
commit
1605fcbbd9
1 changed files with 6 additions and 0 deletions
  1. 6 0
      Tests/RunCMake/FileAPI/codemodel-v2-check.py

+ 6 - 0
Tests/RunCMake/FileAPI/codemodel-v2-check.py

@@ -1,8 +1,14 @@
 from check_index import *
 from check_index import *
 
 
+import json
 import sys
 import sys
 import os
 import os
 
 
+def read_codemodel_json_data(filename):
+    abs_filename = os.path.join(os.path.dirname(os.path.realpath(__file__)), "codemodel-v2-data", filename)
+    with open(abs_filename, "r") as f:
+        return json.load(f)
+
 def check_objects(o, g):
 def check_objects(o, g):
     assert is_list(o)
     assert is_list(o)
     assert len(o) == 1
     assert len(o) == 1