yini-parser 1.0.0-alpha.1 → 1.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +21 -10
  2. package/dist/YINI.d.ts +21 -0
  3. package/dist/{src/YINI.js → YINI.js} +7 -7
  4. package/dist/config/env.d.ts +20 -0
  5. package/dist/core/ErrorDataHandler.d.ts +60 -0
  6. package/dist/core/YINIVisitor.d.ts +149 -0
  7. package/dist/core/objectBuilder.d.ts +6 -0
  8. package/dist/core/types.d.ts +49 -0
  9. package/dist/grammar/YiniLexer.d.ts +68 -0
  10. package/dist/grammar/YiniParser.d.ts +284 -0
  11. package/dist/grammar/YiniParserVisitor.d.ts +143 -0
  12. package/dist/index.d.ts +1 -0
  13. package/dist/parseEntry.d.ts +2 -0
  14. package/dist/parsers/extractHeaderParts.d.ts +31 -0
  15. package/dist/parsers/extractSignificantYiniLine.d.ts +9 -0
  16. package/dist/parsers/parseBoolean.d.ts +5 -0
  17. package/dist/parsers/parseNull.d.ts +2 -0
  18. package/dist/parsers/parseNumber.d.ts +6 -0
  19. package/dist/parsers/parseSectionHeader.d.ts +13 -0
  20. package/dist/parsers/parseString.d.ts +2 -0
  21. package/dist/utils/pathAndFileName.d.ts +5 -0
  22. package/dist/utils/string.d.ts +42 -0
  23. package/dist/utils/system.d.ts +7 -0
  24. package/dist/yiniHelpers.d.ts +44 -0
  25. package/package.json +17 -18
  26. package/dist/tests/integration/1-core-parsing/parse-bigger-section-nesting-as-object.test.js +0 -83
  27. package/dist/tests/integration/1-core-parsing/parse-section-nesting-w-classic-markers.test.js +0 -170
  28. package/dist/tests/integration/1-core-parsing/parse-section-nesting-w-nsh-markers.test.js +0 -27
  29. package/dist/tests/integration/1-core-parsing/read some values from level 1 and 2.test.js +0 -77
  30. package/dist/tests/integration/1-core-parsing/throw on bad section heads.test.js +0 -162
  31. package/dist/tests/integration/10-special-validation-modes/validation-modes.test.js +0 -38
  32. package/dist/tests/integration/2-file-structure-and-error/able to parse mixed case filenames.test.js +0 -72
  33. package/dist/tests/integration/2-file-structure-and-error/throw error on bad file extensions.test.js +0 -36
  34. package/dist/tests/integration/2-file-structure-and-error/throw error parsing bad content.test.js +0 -80
  35. package/dist/tests/smoke/A-general-smoke.test.js +0 -259
  36. package/dist/tests/smoke/B-parse-inline-smoke.test.js +0 -270
  37. package/dist/tests/smoke/C-traverse-file-smoke.test.js +0 -141
  38. package/dist/tests/smoke/D-parse-file-smoke.test.js +0 -134
  39. package/dist/tests/unit/parsers/extractHeaderParts.unit.test.js +0 -490
  40. package/dist/tests/unit/parsers/parseSectionHeader-classic.unit.test.js +0 -421
  41. package/dist/tests/unit/parsers/parseSectionHeader-nsh.unit.test.js +0 -436
  42. package/dist/tests/unit/parsers/parseSectionHeader-throw-on-invalid.unit.test.js +0 -168
  43. package/dist/tests/unit/utils/utils-pathAndFileName.unit.test.js +0 -80
  44. package/dist/tests/unit/utils/utils-string.unit.test.js +0 -185
  45. package/dist/tests/unit/yiniHelpers.unit.test.js +0 -306
  46. /package/dist/{src/config → config}/env.js +0 -0
  47. /package/dist/{src/core → core}/ErrorDataHandler.js +0 -0
  48. /package/dist/{src/core → core}/YINIVisitor.js +0 -0
  49. /package/dist/{src/core → core}/objectBuilder.js +0 -0
  50. /package/dist/{src/core → core}/types.js +0 -0
  51. /package/dist/{src/grammar → grammar}/YiniLexer.js +0 -0
  52. /package/dist/{src/grammar → grammar}/YiniParser.js +0 -0
  53. /package/dist/{src/grammar → grammar}/YiniParserVisitor.js +0 -0
  54. /package/dist/{src/index.js → index.js} +0 -0
  55. /package/dist/{src/parseEntry.js → parseEntry.js} +0 -0
  56. /package/dist/{src/parsers → parsers}/extractHeaderParts.js +0 -0
  57. /package/dist/{src/parsers → parsers}/extractSignificantYiniLine.js +0 -0
  58. /package/dist/{src/parsers → parsers}/parseBoolean.js +0 -0
  59. /package/dist/{src/parsers → parsers}/parseNull.js +0 -0
  60. /package/dist/{src/parsers → parsers}/parseNumber.js +0 -0
  61. /package/dist/{src/parsers → parsers}/parseSectionHeader.js +0 -0
  62. /package/dist/{src/parsers → parsers}/parseString.js +0 -0
  63. /package/dist/{src/utils → utils}/pathAndFileName.js +0 -0
  64. /package/dist/{src/utils → utils}/string.js +0 -0
  65. /package/dist/{src/utils → utils}/system.js +0 -0
  66. /package/dist/{src/yiniHelpers.js → yiniHelpers.js} +0 -0
@@ -1,421 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const ErrorDataHandler_1 = require("../../../src/core/ErrorDataHandler");
7
- const parseSectionHeader_1 = __importDefault(require("../../../src/parsers/parseSectionHeader"));
8
- /**
9
- * Parse classic section header unit tests.
10
- */
11
- describe('Parse classic section header unit tests:', () => {
12
- let eh;
13
- beforeAll(() => {
14
- eh = new ErrorDataHandler_1.ErrorDataHandler('1-Abort-on-Errors');
15
- });
16
- test('1.a. Identify classic section header with level 1.', () => {
17
- // Arrange.
18
- const fixture = '^ SectionName';
19
- // Act.
20
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
21
- // Assert.
22
- expect(markerType).not.toEqual('Numeric-Header-Marker');
23
- expect(markerType).toEqual('Classic-Header-Marker');
24
- expect(sectionName).toEqual('SectionName');
25
- expect(sectionLevel).toEqual(1);
26
- });
27
- test('1.b. Identify classic section header with level 1 with tabbed delimeter.', () => {
28
- // Arrange.
29
- const fixture = '^\tSectionName';
30
- // Act.
31
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
32
- // Assert.
33
- expect(markerType).not.toEqual('Numeric-Header-Marker');
34
- expect(markerType).toEqual('Classic-Header-Marker');
35
- expect(sectionName).toEqual('SectionName');
36
- expect(sectionLevel).toEqual(1);
37
- });
38
- test('1.c. Identify classic section header with level 1 with multiple spaces.', () => {
39
- // Arrange.
40
- const fixture = '^ SectionName';
41
- // Act.
42
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
43
- // Assert.
44
- expect(markerType).not.toEqual('Numeric-Header-Marker');
45
- expect(markerType).toEqual('Classic-Header-Marker');
46
- expect(sectionName).toEqual('SectionName');
47
- expect(sectionLevel).toEqual(1);
48
- });
49
- test('1.d. Identify classic section header with level 1 with any WS delimeters.', () => {
50
- // Arrange.
51
- const fixture = '^\t \t SectionName';
52
- // Act.
53
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
54
- // Assert.
55
- expect(markerType).not.toEqual('Numeric-Header-Marker');
56
- expect(markerType).toEqual('Classic-Header-Marker');
57
- expect(sectionName).toEqual('SectionName');
58
- expect(sectionLevel).toEqual(1);
59
- });
60
- test('1.e. Identify classic section header with level 1 with a comment and any WS delimeters.', () => {
61
- // Arrange.
62
- const fixture = '^\t \t SectionName // This part is a comment.';
63
- // Act.
64
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
65
- // Assert.
66
- expect(markerType).not.toEqual('Numeric-Header-Marker');
67
- expect(markerType).toEqual('Classic-Header-Marker');
68
- expect(sectionName).toEqual('SectionName');
69
- expect(sectionLevel).toEqual(1);
70
- });
71
- test('2.a. Identify classic section header with level 1 and backticked name.', () => {
72
- // Arrange.
73
- const fixture = '^ `Section Name`';
74
- // Act.
75
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
76
- // Assert.
77
- expect(markerType).not.toEqual('Numeric-Header-Marker');
78
- expect(markerType).toEqual('Classic-Header-Marker');
79
- expect(sectionName).toEqual('`Section Name`');
80
- expect(sectionLevel).toEqual(1);
81
- });
82
- test('2.b. Identify classic section header with level 1 with tabbed delimeter and backticked name.', () => {
83
- // Arrange.
84
- const fixture = '^\t`Section Name`';
85
- // Act.
86
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
87
- // Assert.
88
- expect(markerType).not.toEqual('Numeric-Header-Marker');
89
- expect(markerType).toEqual('Classic-Header-Marker');
90
- expect(sectionName).toEqual('`Section Name`');
91
- expect(sectionLevel).toEqual(1);
92
- });
93
- test('2.c. Identify classic section header with level 1 with multiple spaces and backticked name.', () => {
94
- // Arrange.
95
- const fixture = '^ `Section Name`';
96
- // Act.
97
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
98
- // Assert.
99
- expect(markerType).not.toEqual('Numeric-Header-Marker');
100
- expect(markerType).toEqual('Classic-Header-Marker');
101
- expect(sectionName).toEqual('`Section Name`');
102
- expect(sectionLevel).toEqual(1);
103
- });
104
- test('2.d. Identify classic section header with level 1 with any WS delimeters and backticked name.', () => {
105
- // Arrange.
106
- const fixture = '^\t \t `Section Name`';
107
- // Act.
108
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
109
- // Assert.
110
- expect(markerType).not.toEqual('Numeric-Header-Marker');
111
- expect(markerType).toEqual('Classic-Header-Marker');
112
- expect(sectionName).toEqual('`Section Name`');
113
- expect(sectionLevel).toEqual(1);
114
- });
115
- test('2.e. Identify classic section header with level 1 with a comment and any WS delimeters and backticked name.', () => {
116
- // Arrange.
117
- const fixture = '^\t \t `Section Name` # This part is a comment.';
118
- // Act.
119
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
120
- // Assert.
121
- expect(markerType).not.toEqual('Numeric-Header-Marker');
122
- expect(markerType).toEqual('Classic-Header-Marker');
123
- expect(sectionName).toEqual('`Section Name`');
124
- expect(sectionLevel).toEqual(1);
125
- });
126
- test('3.a. Identify classic section header with level 1, compact (no WS).', () => {
127
- // Arrange.
128
- const fixture = '^SectionName';
129
- // Act.
130
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
131
- // Assert.
132
- expect(markerType).not.toEqual('Numeric-Header-Marker');
133
- expect(markerType).toEqual('Classic-Header-Marker');
134
- expect(sectionName).toEqual('SectionName');
135
- expect(sectionLevel).toEqual(1);
136
- });
137
- test('3.b. Identify classic section header with level 1 with comment, compact (no WS).', () => {
138
- // Arrange.
139
- const fixture = '^SectionName // This is a section header.';
140
- // Act.
141
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
142
- // Assert.
143
- expect(markerType).not.toEqual('Numeric-Header-Marker');
144
- expect(markerType).toEqual('Classic-Header-Marker');
145
- expect(sectionName).toEqual('SectionName');
146
- expect(sectionLevel).toEqual(1);
147
- });
148
- test('3.c. Identify classic section header with level 1 with comment, compact (no WS).', () => {
149
- // Arrange.
150
- const fixture = '^SectionName # This part is a comment.';
151
- // Act.
152
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
153
- // Assert.
154
- expect(markerType).not.toEqual('Numeric-Header-Marker');
155
- expect(markerType).toEqual('Classic-Header-Marker');
156
- expect(sectionName).toEqual('SectionName');
157
- expect(sectionLevel).toEqual(1);
158
- });
159
- test('3.d. Identify classic section header with level 1 with comment, compact (no WS).', () => {
160
- // Arrange.
161
- const fixture = '^SectionName// This is a section header.';
162
- // Act.
163
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
164
- // Assert.
165
- expect(markerType).not.toEqual('Numeric-Header-Marker');
166
- expect(markerType).toEqual('Classic-Header-Marker');
167
- expect(sectionName).toEqual('SectionName');
168
- expect(sectionLevel).toEqual(1);
169
- });
170
- test('3.e. Identify classic section header with level 1 with comment, compact (no WS).', () => {
171
- // Arrange.
172
- const fixture = '^SectionName# This part is a comment.';
173
- // Act.
174
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
175
- // Assert.
176
- expect(markerType).not.toEqual('Numeric-Header-Marker');
177
- expect(markerType).toEqual('Classic-Header-Marker');
178
- expect(sectionName).toEqual('SectionName');
179
- expect(sectionLevel).toEqual(1);
180
- });
181
- test('3.f. Identify classic section header with level 1 enclosed in comments, compact (no WS).', () => {
182
- // Arrange.
183
- const fixture = `// This whole line is a comment.
184
- ^SectionName# This part is a comment.
185
- // This whole line is a comment.
186
- `;
187
- // Act.
188
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
189
- // Assert.
190
- expect(markerType).not.toEqual('Numeric-Header-Marker');
191
- expect(markerType).toEqual('Classic-Header-Marker');
192
- expect(sectionName).toEqual('SectionName');
193
- expect(sectionLevel).toEqual(1);
194
- });
195
- test('4.a. Identify classic section header with level 1, backticked name, compact (no WS).', () => {
196
- // Arrange.
197
- const fixture = '^`Section Name`';
198
- // Act.
199
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
200
- // Assert.
201
- expect(markerType).not.toEqual('Numeric-Header-Marker');
202
- expect(markerType).toEqual('Classic-Header-Marker');
203
- expect(sectionName).toEqual('`Section Name`');
204
- expect(sectionLevel).toEqual(1);
205
- });
206
- test('4.b. Identify classic section header with level 1 with backticked name and comment, compact (no WS).', () => {
207
- // Arrange.
208
- const fixture = '^`Section Name` // Comment.';
209
- // Act.
210
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
211
- // Assert.
212
- expect(markerType).not.toEqual('Numeric-Header-Marker');
213
- expect(markerType).toEqual('Classic-Header-Marker');
214
- expect(sectionName).toEqual('`Section Name`');
215
- expect(sectionLevel).toEqual(1);
216
- });
217
- test('4.c. Identify classic section header with level 1 with backticked name and comment, compact (no WS).', () => {
218
- // Arrange.
219
- const fixture = '^`Section Name` # Comment.';
220
- // Act.
221
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
222
- // Assert.
223
- expect(markerType).not.toEqual('Numeric-Header-Marker');
224
- expect(markerType).toEqual('Classic-Header-Marker');
225
- expect(sectionName).toEqual('`Section Name`');
226
- expect(sectionLevel).toEqual(1);
227
- });
228
- test('4.d. Identify classic section header with level 1 with backticked name and comment, compact (no WS).', () => {
229
- // Arrange.
230
- const fixture = '^`Section Name`// This part is a comment.';
231
- // Act.
232
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
233
- // Assert.
234
- expect(markerType).not.toEqual('Numeric-Header-Marker');
235
- expect(markerType).toEqual('Classic-Header-Marker');
236
- expect(sectionName).toEqual('`Section Name`');
237
- expect(sectionLevel).toEqual(1);
238
- });
239
- test('5.a. Identify classic section header with level 2.', () => {
240
- // Arrange.
241
- const fixture = '^^ SectionName';
242
- // Act.
243
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
244
- // Assert.
245
- expect(markerType).not.toEqual('Numeric-Header-Marker');
246
- expect(markerType).toEqual('Classic-Header-Marker');
247
- expect(sectionName).toEqual('SectionName');
248
- expect(sectionLevel).toEqual(2);
249
- });
250
- test('5.b. Identify classic section header with level 2 and comment.', () => {
251
- // Arrange.
252
- const fixture = '^^ SectionName // This part is a comment.';
253
- // Act.
254
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
255
- // Assert.
256
- expect(markerType).not.toEqual('Numeric-Header-Marker');
257
- expect(markerType).toEqual('Classic-Header-Marker');
258
- expect(sectionName).toEqual('SectionName');
259
- expect(sectionLevel).toEqual(2);
260
- });
261
- test('6.a. Identify classic section header with level 3.', () => {
262
- // Arrange.
263
- const fixture = '^^^ SectionName';
264
- // Act.
265
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
266
- // Assert.
267
- expect(markerType).not.toEqual('Numeric-Header-Marker');
268
- expect(markerType).toEqual('Classic-Header-Marker');
269
- expect(sectionName).toEqual('SectionName');
270
- expect(sectionLevel).toEqual(3);
271
- });
272
- test('6.b. Identify classic section header with level 3, compact (no WS).', () => {
273
- // Arrange.
274
- const fixture = '^^^SectionName';
275
- // Act.
276
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
277
- // Assert.
278
- expect(markerType).not.toEqual('Numeric-Header-Marker');
279
- expect(markerType).toEqual('Classic-Header-Marker');
280
- expect(sectionName).toEqual('SectionName');
281
- expect(sectionLevel).toEqual(3);
282
- });
283
- test('7.a. Identify classic section header with level 4.', () => {
284
- // Arrange.
285
- const fixture = '^^^^ SectionName';
286
- // Act.
287
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
288
- // Assert.
289
- expect(markerType).not.toEqual('Numeric-Header-Marker');
290
- expect(markerType).toEqual('Classic-Header-Marker');
291
- expect(sectionName).toEqual('SectionName');
292
- expect(sectionLevel).toEqual(4);
293
- });
294
- test('7.b. Identify classic section header with level 4 with backticked name.', () => {
295
- // Arrange.
296
- const fixture = '^^^^ `Section Name`';
297
- // Act.
298
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
299
- // Assert.
300
- expect(markerType).not.toEqual('Numeric-Header-Marker');
301
- expect(markerType).toEqual('Classic-Header-Marker');
302
- expect(sectionName).toEqual('`Section Name`');
303
- expect(sectionLevel).toEqual(4);
304
- });
305
- test('8.a. Identify classic section header with level 5.', () => {
306
- // Arrange.
307
- const fixture = '^^^^^ SectionName';
308
- // Act.
309
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
310
- // Assert.
311
- expect(markerType).not.toEqual('Numeric-Header-Marker');
312
- expect(markerType).toEqual('Classic-Header-Marker');
313
- expect(sectionName).toEqual('SectionName');
314
- expect(sectionLevel).toEqual(5);
315
- });
316
- test('8.b. Identify classic section header with level 5, with many WS.', () => {
317
- // Arrange.
318
- const fixture = '^^^^^ \tSectionName';
319
- // Act.
320
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
321
- // Assert.
322
- expect(markerType).not.toEqual('Numeric-Header-Marker');
323
- expect(markerType).toEqual('Classic-Header-Marker');
324
- expect(sectionName).toEqual('SectionName');
325
- expect(sectionLevel).toEqual(5);
326
- });
327
- test('9.a. Identify classic section header with level 6.', () => {
328
- // Arrange.
329
- const fixture = '^^^^^^ SectionName';
330
- // Act.
331
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
332
- // Assert.
333
- expect(markerType).not.toEqual('Numeric-Header-Marker');
334
- expect(markerType).toEqual('Classic-Header-Marker');
335
- expect(sectionName).toEqual('SectionName');
336
- expect(sectionLevel).toEqual(6);
337
- });
338
- test('9.b. Identify classic section header with level 6, compact with backticed name and comment.', () => {
339
- // Arrange.
340
- const fixture = `;This line is comment.
341
- ^^^^^^\`Section Name\`//Comment here.
342
- ;This line is comment.
343
- `;
344
- // Act.
345
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
346
- // Assert.
347
- expect(markerType).not.toEqual('Numeric-Header-Marker');
348
- expect(markerType).toEqual('Classic-Header-Marker');
349
- expect(sectionName).toEqual('`Section Name`');
350
- expect(sectionLevel).toEqual(6);
351
- });
352
- test('10.a. Identify classic section header with level 1 and alternative character marker (~).', () => {
353
- // Arrange.
354
- const fixture = '~ SectionName';
355
- // Act.
356
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
357
- // Assert.
358
- expect(markerType).not.toEqual('Numeric-Header-Marker');
359
- expect(markerType).toEqual('Classic-Header-Marker');
360
- expect(sectionName).toEqual('SectionName');
361
- expect(sectionLevel).toEqual(1);
362
- });
363
- test('10.b. Identify classic section header with level 2 with tabbed delimeter and alternative character marker (§).', () => {
364
- // Arrange.
365
- const fixture = '§§\tSectionName';
366
- // Act.
367
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
368
- // Assert.
369
- expect(markerType).not.toEqual('Numeric-Header-Marker');
370
- expect(markerType).toEqual('Classic-Header-Marker');
371
- expect(sectionName).toEqual('SectionName');
372
- expect(sectionLevel).toEqual(2);
373
- });
374
- test('10.c. Identify classic section header with level 2 with tabbed delimeter and alternative character marker (€).', () => {
375
- // Arrange.
376
- const fixture = '€€\tSectionName';
377
- // Act.
378
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
379
- // Assert.
380
- expect(markerType).not.toEqual('Numeric-Header-Marker');
381
- expect(markerType).toEqual('Classic-Header-Marker');
382
- expect(sectionName).toEqual('SectionName');
383
- expect(sectionLevel).toEqual(2);
384
- });
385
- test('11.a. Identify classic section header with level 4 and alternative character marker (~).', () => {
386
- // Arrange.
387
- const fixture = '~~~~ SectionName // This part is a comment.';
388
- // Act.
389
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
390
- // Assert.
391
- expect(markerType).not.toEqual('Numeric-Header-Marker');
392
- expect(markerType).toEqual('Classic-Header-Marker');
393
- expect(sectionName).toEqual('SectionName');
394
- expect(sectionLevel).toEqual(4);
395
- });
396
- test('11.b. Identify classic section header with level 5 with tabbed delimeter and alternative character marker (§).', () => {
397
- // Arrange.
398
- const fixture = '§§§§§SectionName # This part is a comment.';
399
- // Act.
400
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
401
- // Assert.
402
- expect(markerType).not.toEqual('Numeric-Header-Marker');
403
- expect(markerType).toEqual('Classic-Header-Marker');
404
- expect(sectionName).toEqual('SectionName');
405
- expect(sectionLevel).toEqual(5);
406
- });
407
- test('11.c. Identify classic section header with level 6 with tabbed delimeter and alternative character marker (€).', () => {
408
- // Arrange.
409
- const fixture = `// This line is a comment.
410
- €€€€€€ SectionName# This part is a comment.
411
- ; This line is a comment.
412
- `;
413
- // Act.
414
- const { markerType, sectionName, sectionLevel } = (0, parseSectionHeader_1.default)(fixture, eh, null);
415
- // Assert.
416
- expect(markerType).not.toEqual('Numeric-Header-Marker');
417
- expect(markerType).toEqual('Classic-Header-Marker');
418
- expect(sectionName).toEqual('SectionName');
419
- expect(sectionLevel).toEqual(6);
420
- });
421
- });