aboutsummaryrefslogtreecommitdiffstats
path: root/JSONSchema/validate.js
diff options
context:
space:
mode:
authorJared Wasinger <j-wasinger@hotmail.com>2017-07-06 04:33:09 +0800
committerUbuntu <ubuntu@ip-172-31-32-43.us-west-2.compute.internal>2017-08-08 04:41:46 +0800
commit291c054b2731de7172579ca629d1499be44f15fa (patch)
tree53667008e971dae06abf186ec0e2046c33e04b60 /JSONSchema/validate.js
parent6117849a700de4d1fcb7245b2cfffbd3382c6cf8 (diff)
downloaddexon-tests-291c054b2731de7172579ca629d1499be44f15fa.tar
dexon-tests-291c054b2731de7172579ca629d1499be44f15fa.tar.gz
dexon-tests-291c054b2731de7172579ca629d1499be44f15fa.tar.bz2
dexon-tests-291c054b2731de7172579ca629d1499be44f15fa.tar.lz
dexon-tests-291c054b2731de7172579ca629d1499be44f15fa.tar.xz
dexon-tests-291c054b2731de7172579ca629d1499be44f15fa.tar.zst
dexon-tests-291c054b2731de7172579ca629d1499be44f15fa.zip
format code. Remove unused python code
Diffstat (limited to 'JSONSchema/validate.js')
-rwxr-xr-xJSONSchema/validate.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/JSONSchema/validate.js b/JSONSchema/validate.js
index 6c44b834f..e3037ccad 100755
--- a/JSONSchema/validate.js
+++ b/JSONSchema/validate.js
@@ -4,17 +4,20 @@ var validate = require('jsonschema').validate;
var fs = require('fs');
var readline = require('readline');
+var process = require('process');
+
var schema = '';
var testCode = '';
+var success = true;
var readline = require('readline');
var rl = readline.createInterface({
- input: process.stdin,
- output: process.stdout,
- terminal: false
+ input: process.stdin,
+ output: process.stdout,
+ terminal: false
});
-rl.on('line', function(line){
+rl.on('line', function(line) {
fs.readFile('JSONSchema/schema.json', function(err, data) {
if (err) {
throw err;
@@ -29,7 +32,7 @@ rl.on('line', function(line){
try {
testCode = JSON.parse(data);
- } catch(e) {
+ } catch (e) {
console.log(e);
}
@@ -37,12 +40,13 @@ rl.on('line', function(line){
var x = validate(testCode, schema);
if (x.errors.length > 0) {
- console.log(line+':\n');
+ success = false;
+ console.log(line + ':\n');
for (var i = 0; i < x.errors.length; i++) {
- console.log(' '+x.errors[i]+'\n')
+ console.log(' ' + x.errors[i] + '\n')
}
}
- } catch(e) {
+ } catch (e) {
console.log(e);
}
});