quotes.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. var browserify = require('../');
  2. var vm = require('vm');
  3. var test = require('tap').test;
  4. var hasTemplateLiterals = require('has-template-literals')();
  5. test('quotes', function (t) {
  6. t.plan(2);
  7. var b = browserify(__dirname + '/quotes/main.js');
  8. b.bundle(function (err, src) {
  9. var c = {
  10. done : function (single, double) {
  11. t.equal(single, 'success', 'single quotes');
  12. t.equal(double, 'success', 'double quotes');
  13. t.end();
  14. }
  15. };
  16. vm.runInNewContext(src, c);
  17. });
  18. });
  19. test('interpolation literals', { skip: !hasTemplateLiterals }, function (t) {
  20. t.plan(3);
  21. var b = browserify(__dirname + '/quotes/backtick.js');
  22. b.bundle(function (err, src) {
  23. var c = {
  24. done : function (single, double, backtick) {
  25. t.equal(single, 'success', 'single quotes');
  26. t.equal(double, 'success', 'double quotes');
  27. t.equal(backtick, 'success', 'backtick quotes');
  28. t.end();
  29. }
  30. };
  31. vm.runInNewContext(src, c);
  32. });
  33. });