Dieses Repository beinhaltet HTML- und Javascript Code zur einer NotizenWebApp auf Basis von Web Storage. Zudem sind Mocha/Chai Tests im Browser enthalten. https://meinenotizen.netlify.app/
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.

getSymbolDescription.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. 'use strict';
  2. var test = require('tape');
  3. var debug = require('object-inspect');
  4. var forEach = require('foreach');
  5. var v = require('./values');
  6. var getSymbolDescription = require('../../helpers/getSymbolDescription');
  7. var getInferredName = require('../../helpers/getInferredName');
  8. test('getSymbolDescription', function (t) {
  9. t.test('no symbols', { skip: v.hasSymbols }, function (st) {
  10. st['throws'](
  11. getSymbolDescription,
  12. SyntaxError,
  13. 'requires Symbol support'
  14. );
  15. st.end();
  16. });
  17. forEach(v.nonSymbolPrimitives.concat(v.objects), function (nonSymbol) {
  18. t['throws'](
  19. function () { getSymbolDescription(nonSymbol); },
  20. v.hasSymbols ? TypeError : SyntaxError,
  21. debug(nonSymbol) + ' is not a Symbol'
  22. );
  23. });
  24. t.test('with symbols', { skip: !v.hasSymbols }, function (st) {
  25. forEach(
  26. [
  27. [Symbol(), undefined],
  28. [Symbol(undefined), undefined],
  29. [Symbol(null), 'null'],
  30. [Symbol.iterator, 'Symbol.iterator'],
  31. [Symbol('foo'), 'foo']
  32. ],
  33. function (pair) {
  34. var sym = pair[0];
  35. var desc = pair[1];
  36. st.equal(getSymbolDescription(sym), desc, debug(sym) + ' yields ' + debug(desc));
  37. }
  38. );
  39. st.test('only possible when inference is supported', { skip: !getInferredName }, function (s2t) {
  40. s2t.equal(getSymbolDescription(Symbol('')), '', 'Symbol("") description is empty string');
  41. s2t.end();
  42. });
  43. st.end();
  44. });
  45. t.end();
  46. });