GetIntrinsic.js 735 B

12345678910111213141516171819202122232425262728293031323334
  1. 'use strict';
  2. var GetIntrinsic = require('../GetIntrinsic');
  3. var test = require('tape');
  4. var forEach = require('foreach');
  5. var debug = require('object-inspect');
  6. var v = require('./helpers/values');
  7. test('export', function (t) {
  8. t.equal(typeof GetIntrinsic, 'function', 'it is a function');
  9. t.equal(GetIntrinsic.length, 2, 'function has length of 2');
  10. t.end();
  11. });
  12. test('throws', function (t) {
  13. t['throws'](
  14. function () { GetIntrinsic('not an intrinsic'); },
  15. SyntaxError,
  16. 'nonexistent intrinsic throws a syntax error'
  17. );
  18. forEach(v.nonBooleans, function (nonBoolean) {
  19. t['throws'](
  20. function () { GetIntrinsic('%', nonBoolean); },
  21. TypeError,
  22. debug(nonBoolean) + ' is not a Boolean'
  23. );
  24. });
  25. t.end();
  26. });