MCPcopy Create free account
hub / github.com/argotorg/solidity / checkJSONPath

Function checkJSONPath

test/buglistTests.js:74–102  ·  view source on GitHub ↗
(name, buggy, fine)

Source from the content-addressed store, hash-verified

72}
73
74async function checkJSONPath(name, buggy, fine)
75{
76 var jsonPath = bugsByName[name].check['ast-compact-json-path']
77 if (jsonPath !== undefined)
78 {
79 var url = "https://github.com/argotorg/solidity/releases/download/v" + bugsByName[name].introduced + "/solc-static-linux"
80 try {
81 var tmpdir = await mktemp.createDir('XXXXX')
82 var binary = tmpdir + "/solc-static-linux"
83 await download(url, tmpdir)
84 exec("chmod +x " + binary)
85 for (var i in buggy)
86 {
87 var result = await checkJsonPathTest(buggy[i], tmpdir, binary, jsonPath, i)
88 if (!result)
89 throw "Bug " + name + ": Buggy source does not contain path: " + buggy[i]
90 }
91 for (var i in fine)
92 {
93 var result = await checkJsonPathTest(fine[i], tmpdir, binary, jsonPath, i + buggy.length)
94 if (result)
95 throw "Bug " + name + ": Non-buggy source contains path: " + fine[i]
96 }
97 exec("rm -r " + tmpdir)
98 } catch (err) {
99 throw err
100 }
101 }
102}
103
104function checkJsonPathTest(code, tmpdir, binary, query, idx) {
105 return new Promise(function(resolve, reject) {

Callers 1

runTestsFunction · 0.85

Calls 1

checkJsonPathTestFunction · 0.85

Tested by

no test coverage detected