Adding check for out of order numbers
This commit is contained in:
parent
ccdb29224a
commit
55657a792b
@ -31,4 +31,11 @@ describe('parser/javascript/repeat_spec.js', function() {
|
|||||||
expect(parser.__consume__repeat_spec()).toEqual(null);
|
expect(parser.__consume__repeat_spec()).toEqual(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('throws an exception when the numbers are out of order', function() {
|
||||||
|
var parser = new javascript.Parser('{42,24}');
|
||||||
|
expect(() => {
|
||||||
|
parser.__consume__repeat_spec();
|
||||||
|
}).toThrow('Numbers out of order: {42,24}');
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -15,5 +15,9 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.maximum = -1;
|
this.maximum = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.minimum > this.maximum && this.maximum !== -1) {
|
||||||
|
throw `Numbers out of order: ${this.textValue}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user