浏览代码

FileAPI test: Add infrastructure for reading JSON test data

Kyle Edwards 5 年之前
父节点
当前提交
1605fcbbd9
共有 1 个文件被更改,包括 6 次插入0 次删除
  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 *
 
+import json
 import sys
 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):
     assert is_list(o)
     assert len(o) == 1