complicated.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. var test = require('tap').test;
  2. var detective = require('../');
  3. var sources = [
  4. 'require("a")',
  5. "require('a')",
  6. 'require(`a`)',
  7. ';require("a")',
  8. ' require("a")',
  9. 'void require("a")',
  10. '+require("a")',
  11. '!require("a")',
  12. '/*comments*/require("a")',
  13. '(require("a"))',
  14. 'require/*comments*/("a")',
  15. ';require/*comments*/("a")',
  16. ' require/*comments*/("a")',
  17. 'void require/*comments*/("a")',
  18. '+require/*comments*/("a")',
  19. '!require/*comments*/("a")',
  20. '/*comments*/require/*comments*/("a")',
  21. '(require/*comments*/("a"))',
  22. 'require /*comments*/ ("a")',
  23. ';require /*comments*/ ("a")',
  24. ' require /*comments*/ ("a")',
  25. 'void require /*comments*/ ("a")',
  26. '+require /*comments*/ ("a")',
  27. '!require /*comments*/ ("a")',
  28. ' /*comments*/ require /*comments*/ ("a")',
  29. '(require /*comments*/ ("a"))',
  30. 'require /*comments*/ /*more comments*/ ("a")',
  31. ';require /*comments*/ /*more comments*/ ("a")',
  32. ' require /*comments*/ /*more comments*/ ("a")',
  33. 'void require /*comments*/ /*more comments*/ ("a")',
  34. '+require /*comments*/ /*more comments*/ ("a")',
  35. '!require /*comments*/ /*more comments*/ ("a")',
  36. ' /*comments*/ /*more comments*/ require /*comments*/ /*more comments*/ ("a")',
  37. '(require /*comments*/ /*more comments*/ ("a"))',
  38. 'require//comments\n("a")',
  39. ';require//comments\n("a")',
  40. ' require//comments\n("a")',
  41. 'void require//comments\n("a")',
  42. '+require//comments\n("a")',
  43. '!require//comments\n("a")',
  44. ' require//comments\n("a")',
  45. '(require//comments\n("a"))'
  46. ];
  47. test('complicated', function (t) {
  48. t.plan(sources.length);
  49. sources.forEach(function(src) {
  50. t.deepEqual(detective(src), [ 'a' ]);
  51. });
  52. });