diff options
author | Everett Hildenbrandt <hildenb2@illinois.edu> | 2018-05-29 04:42:19 +0800 |
---|---|---|
committer | Everett Hildenbrandt <hildenb2@illinois.edu> | 2018-05-31 22:37:30 +0800 |
commit | 6496a2e859acd373abfb6fec745caa3bc3fb52c3 (patch) | |
tree | 20edba8b32b54602e58dfe1a60586aaf2ee5fe0f | |
parent | 196b3c06a21b0ea3d0eb7b9274751ecb891bb1d7 (diff) | |
download | dexon-tests-6496a2e859acd373abfb6fec745caa3bc3fb52c3.tar dexon-tests-6496a2e859acd373abfb6fec745caa3bc3fb52c3.tar.gz dexon-tests-6496a2e859acd373abfb6fec745caa3bc3fb52c3.tar.bz2 dexon-tests-6496a2e859acd373abfb6fec745caa3bc3fb52c3.tar.lz dexon-tests-6496a2e859acd373abfb6fec745caa3bc3fb52c3.tar.xz dexon-tests-6496a2e859acd373abfb6fec745caa3bc3fb52c3.tar.zst dexon-tests-6496a2e859acd373abfb6fec745caa3bc3fb52c3.zip |
JSONSchema/validate: remove now unused file
-rwxr-xr-x | JSONSchema/validate.js | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/JSONSchema/validate.js b/JSONSchema/validate.js deleted file mode 100755 index e4c41140e..000000000 --- a/JSONSchema/validate.js +++ /dev/null @@ -1,82 +0,0 @@ -#! /bin/env node - -var fs = require('fs'); -var validate = require('jsonschema').validate; -var readline = require('readline'); -var process = require('process'); -var dup = require('json-dup-key-validator'); - -var schemaFile = process.argv[2]; - -var schema = ''; -var testCode = ''; -var success = true; -var numFiles = 0; -var numFailed = 0; -var numSucceeded = 0; -var fileNames = []; - -var rl = readline.createInterface({ - input: process.stdin, - output: process.stdout, - terminal: false -}); - -rl.on('line', function(fileName) { - if (fileName == 'BlockchainTests/bcForgedTest/bcInvalidRLPTest.json') { - return - } - fileNames.push(fileName); -}); - -rl.on('close', function() { - var jsonString = fs.readFileSync(schemaFile, "utf8"); - schema = dup.parse(jsonString); - - //sort file names alphabetically so that log output ordering is consistent - fileNames.sort(function(a,b) { - if(a<b) { - return -1; - } else { - return 1; - } - - return 0; - }); - - for (var i = 0; i < fileNames.length; i++) { - try { - var jsonString = fs.readFileSync(fileNames[i], "utf8"); - testCode = dup.parse(jsonString); - } catch(e) { - console.log('error on file:', fileNames[i]) - console.log(e); - numFailed++; - continue; - } - - try { - var x = validate(testCode, schema); - - if (x.errors.length > 0) { - numFailed++; - console.log(fileNames[i]+ ':\n'); - for (var j = 0; j < x.errors.length; j++) { - console.log(' ' + x.errors[j] + '\n') - } - } else { - numSucceeded++; - } - } catch (e) { - console.log(e); - numFailed++; - } - } - - console.log("Valid: "+numSucceeded+"\n"); - console.log("Failed: "+numFailed+"\n"); - - if(numFailed > 0) { - process.exit(-1); - } -}); |