starters.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. 'use strict';
  2. let hljs = require('../../build');
  3. const pattern = new RegExp(`^${hljs.RE_STARTERS_RE}$`);
  4. describe('.RE_STARTERS_RE', function() {
  5. it('should match boolean operators', function() {
  6. const operators = [ '!', '!=', '!==', '==', '===', '<=', '>='
  7. , '<', '>', '||', '&&', '?'
  8. ];
  9. operators.should.matchEach(pattern);
  10. });
  11. it('should match arithmetic operators', function() {
  12. const operators = [ '*', '*=', '+', '+=', '-', '-=', '/', '/='
  13. , '%', '%='
  14. ];
  15. operators.should.matchEach(pattern);
  16. });
  17. it('should match binary operators', function() {
  18. const operators = [ '&', '&=', '|', '|=', '<<', '<<=', '>>', '>>='
  19. , '>>>', '>>>=', '^', '^=', '~'
  20. ];
  21. operators.should.matchEach(pattern);
  22. });
  23. it('should match miscellaneous operators', function() {
  24. const operators = [',', '=', ':', ';', '[', '{', '('];
  25. operators.should.matchEach(pattern);
  26. });
  27. });