Rely on jsondiff to strip comments.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 11 Dec 2011 13:38:19 +0000 (13:38 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 11 Dec 2011 13:38:19 +0000 (13:38 +0000)
driver.py

index e488e13ddfaa910565a0b5572fbf2809222d7a9f..9894c9c80447cc806401361b9bf497b8fc4267ab 100755 (executable)
--- a/driver.py
+++ b/driver.py
@@ -333,14 +333,10 @@ class TestCase:
             differ.visit(refState, srcState)
             fail('state from call %u does not match %s' % (callNo, refStateFileName))
 
-    # Allo non-standard JS comments in JSON
-    json_comment_re = re.compile(r'//.*$', re.MULTILINE)
-
     def getRefState(self, refStateFileName):
-        data = open(refStateFileName, 'rt').read()
-        data = self.json_comment_re.sub('', data)
-        state = json.loads(data, strict=False)
-        self.adjustRefState(state)
+        stream = open(refStateFileName, 'rt')
+        from jsondiff import load
+        state = load(stream)
         return state
 
     def getNamePrefix(self):