From 04350351733b1441a2b11502e674b16dd6c47659 Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Tue, 4 Jul 2017 01:15:33 -0700 Subject: modify validation script to run against all test cases under GeneralStateTests --- GeneralStateTests/schema/run.sh | 2 +- GeneralStateTests/schema/validate.js | 34 ++++++++-------------------------- 2 files changed, 9 insertions(+), 27 deletions(-) (limited to 'GeneralStateTests') diff --git a/GeneralStateTests/schema/run.sh b/GeneralStateTests/schema/run.sh index a2a0f2db8..45cfbf363 100755 --- a/GeneralStateTests/schema/run.sh +++ b/GeneralStateTests/schema/run.sh @@ -1 +1 @@ -echo -e "$(find .. -name '*.json')" | node validate.js +echo -e "$(find .. -name '*.json' ! -path '../schema/*.json')" | node validate.js diff --git a/GeneralStateTests/schema/validate.js b/GeneralStateTests/schema/validate.js index 6f2feef9b..af3e3b495 100755 --- a/GeneralStateTests/schema/validate.js +++ b/GeneralStateTests/schema/validate.js @@ -15,15 +15,13 @@ var rl = readline.createInterface({ }); rl.on('line', function(line){ - fs.readFile('simple-schema.json', function(err, data) { + fs.readFile('schema.json', function(err, data) { if (err) { throw err; } - schema = JSON.parse(data); - fs.readFile(line, function(err, data) { if (err) { throw err; @@ -32,35 +30,19 @@ rl.on('line', function(line){ try { testCode = JSON.parse(data); } catch(e) { - debugger; + console.log(e); } try { var x = validate(testCode, schema); + + if (x.errors.length > 0) { + console.log(line+':\n'); + console.log(x.errors+'\n') + } } catch(e) { - console.log(line); + console.log(e); } - }); }); }); - -/* -fs.readFile('simple-schema.json', function(err, data) { - if (err) { - throw err; - } - - schema = JSON.parse(data); - fs.readFile('example.json', function(err, data) { - if (err) { - throw err; - } - - testCode = JSON.parse(data); - var x = validate(testCode, schema); - console.log(x); - debugger; - }); -}); -*/ -- cgit v1.2.3