Simple email application for Android. Original source code: https://framagit.org/dystopia-project/simple-email
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.2 KiB

  1. 'use strict'
  2. // applying esprima to a bunch of files of contained libraries as a smoke test
  3. var test = require('tape')
  4. var path = require('path')
  5. var fs = require('fs')
  6. var readdirp = require('readdirp')
  7. var cardinal = require('..')
  8. var nodeModules = path.join(__dirname, '..', 'node_modules')
  9. var tapedir = path.join(nodeModules, 'tape')
  10. var redeyeddir = path.join(nodeModules, 'redeyed')
  11. test('tape', function(t) {
  12. readdirp({ root: tapedir, fileFilter: '*.js' })
  13. .on('data', function(entry) {
  14. var code = fs.readFileSync(entry.fullPath, 'utf-8')
  15. var result = cardinal.highlight(code)
  16. if (!(/^[^/*]*var /.test(code))) {
  17. t.pass('skipping ' + entry.path + ' due to missing var statement')
  18. } else {
  19. t.assert(~result.indexOf('[32mvar\u001b[39m'), 'highlighted ' + entry.path)
  20. }
  21. })
  22. .on('end', t.end.bind(t))
  23. })
  24. test('redeyed', function(t) {
  25. readdirp({ root: redeyeddir, fileFilter: 'redeyed.js' })
  26. .on('data', function(entry) {
  27. var code = fs.readFileSync(entry.fullPath, 'utf-8')
  28. var result = cardinal.highlight(code)
  29. t.assert(~result.indexOf('[32mvar\u001b[39m') || !(~result.indexOf('var ')), 'highlighted ' + entry.path)
  30. })
  31. .on('end', t.end.bind(t))
  32. })