to-string-tokens.js 814 B

1234567891011121314151617181920212223242526
  1. /* eslint no-eval: "off" */
  2. "use strict";
  3. module.exports = function (t, a) {
  4. a.deep(t.call(function (a, b) { return this[a] + this[b]; }), {
  5. args: "a, b",
  6. body: " return this[a] + this[b]; "
  7. });
  8. a.deep(t.call(function () {}), { args: "", body: "" });
  9. // eslint-disable-next-line no-unused-vars
  10. a.deep(t.call(function (raz) {}), { args: "raz", body: "" });
  11. a.deep(t.call(function () { Object(); }), { args: "", body: " Object(); " });
  12. try {
  13. eval("(() => {})");
  14. } catch (e) {
  15. // Non ES2015 env
  16. return;
  17. }
  18. a.deep(t.call(eval("(() => {})")), { args: "", body: "" });
  19. a.deep(t.call(eval("((elo) => foo)")), { args: "elo", body: "foo" });
  20. a.deep(t.call(eval("(elo => foo)")), { args: "elo", body: "foo" });
  21. a.deep(t.call(eval("((elo, bar) => foo())")), { args: "elo, bar", body: "foo()" });
  22. };