Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

inspect.spec.ts 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import getParser from '../../src/parser/index';
  2. import inspect from '../../src/stringifier/inspect';
  3. import { seedBlock } from '../../src/util';
  4. test('multiple lines', () => {
  5. const source = `
  6. /**
  7. * Description may go\r\r
  8. * over few lines followed by @tags\r
  9. * @param {string} name name parameter
  10. * @param {any} value value of any type
  11. */`.slice(1);
  12. const parsed = getParser()(source);
  13. const expected = `
  14. |line|start|delimiter|postDelimiter|tag |postTag|name |postName|type |postType|description |end|CR |
  15. |----|-----|---------|-------------|------|-------|-----|--------|--------|--------|--------------------------------|---|---|
  16. | 0|{2} |/** | | | | | | | | | | |
  17. | 1|{3} |* |{1} | | | | | | |Description may go | |{2}|
  18. | 2|{3} |* |{1} | | | | | | |over few lines followed by @tags| |{1}|
  19. | 3|{3} |* |{1} |@param|{1} |name |{1} |{string}|{1} |name parameter | | |
  20. | 4|{3} |* |{1} |@param|{1} |value|{1} |{any} |{1} |value of any type | | |
  21. | 5|{3} | | | | | | | | | |*/ | |`;
  22. expect(inspect(parsed[0])).toEqual(expected.slice(1));
  23. });
  24. test('single line', () => {
  25. const source = '/** @param {string} name name parameter */';
  26. const parsed = getParser({ startLine: 12345 })(source);
  27. const expected = `
  28. |line |start|delimiter|postDelimiter|tag |postTag|name|postName|type |postType|description |end|CR|
  29. |-----|-----|---------|-------------|------|-------|----|--------|--------|--------|---------------|---|--|
  30. |12345| |/** |{1} |@param|{1} |name|{1} |{string}|{1} |name parameter |*/ | |`;
  31. expect(inspect(parsed[0])).toEqual(expected.slice(1));
  32. });
  33. test('empty', () => {
  34. const expected = '';
  35. expect(inspect(seedBlock())).toEqual(expected.slice(1));
  36. });