Test serializer exit code
It returns 0, when the configurations identical and 1 otherwise.
This commit is contained in:
@@ -26,12 +26,21 @@ let config2BufferContent = config1Buffer.getBufferContent();
|
||||
fs.writeFileSync('uhk-config-serialized.bin', config2BufferContent);
|
||||
|
||||
console.log('\n');
|
||||
let error: boolean;
|
||||
try {
|
||||
assert.deepEqual(config1Js, config2Js);
|
||||
console.log('JSON configurations are identical.');
|
||||
} catch (error) {
|
||||
console.log('JSON configurations differ.');
|
||||
error = true;
|
||||
}
|
||||
|
||||
let buffersContentsAreEqual = Buffer.compare(config1BufferContent, config2BufferContent) === 0;
|
||||
console.log('Binary configurations ' + (buffersContentsAreEqual ? 'are identical' : 'differ') + '.');
|
||||
const buffersContentsAreEqual: boolean = Buffer.compare(config1BufferContent, config2BufferContent) === 0;
|
||||
if (buffersContentsAreEqual) {
|
||||
console.log('Binary configurations are identical.');
|
||||
} else {
|
||||
console.log('Binary configurations differ.');
|
||||
error = true;
|
||||
}
|
||||
|
||||
process.exit(error ? 1 : 0);
|
||||
|
||||
Reference in New Issue
Block a user