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,490 +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 extractHeaderParts_1 = __importDefault(require("../../../src/parsers/extractHeaderParts"));
7
- const system_1 = require("../../../src/utils/system");
8
- /**
9
- * Extract header parts unit tests.
10
- */
11
- describe('Extract header parts unit tests Unit Tests:', () => {
12
- test('1.a. Extract parts for classic section header with level 1.', () => {
13
- // Arrange.
14
- const fixture = '^ SectionName';
15
- // Act.
16
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
17
- // Assert.
18
- expect(strSectionName).not.toEqual('nonCorrectName');
19
- expect(strMarkerChars).toEqual('^');
20
- expect(strSectionName).toEqual('SectionName');
21
- expect(strNumberPart).toEqual('');
22
- expect(isBacktickedName).toEqual(false);
23
- });
24
- test('1.b. Extract parts for classic section header with level 1 with tabbed delimeter.', () => {
25
- // Arrange.
26
- const fixture = '^\tSectionName';
27
- // Act.
28
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
29
- // Assert.
30
- expect(strSectionName).not.toEqual('nonCorrectName');
31
- expect(strMarkerChars).toEqual('^');
32
- expect(strSectionName).toEqual('SectionName');
33
- expect(strNumberPart).toEqual('');
34
- expect(isBacktickedName).toEqual(false);
35
- });
36
- test('1.c. Extract parts for classic section header with level 1 with multiple spaces.', () => {
37
- // Arrange.
38
- const fixture = '^ SectionName';
39
- // Act.
40
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
41
- // Assert.
42
- expect(strSectionName).not.toEqual('nonCorrectName');
43
- expect(strMarkerChars).toEqual('^');
44
- expect(strSectionName).toEqual('SectionName');
45
- expect(strNumberPart).toEqual('');
46
- expect(isBacktickedName).toEqual(false);
47
- });
48
- test('1.d. Extract parts for classic section header with level 1 with any WS delimeters.', () => {
49
- // Arrange.
50
- const fixture = '^\t \t SectionName';
51
- // Act.
52
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
53
- // Assert.
54
- expect(strSectionName).not.toEqual('nonCorrectName');
55
- expect(strMarkerChars).toEqual('^');
56
- expect(strSectionName).toEqual('SectionName');
57
- expect(strNumberPart).toEqual('');
58
- expect(isBacktickedName).toEqual(false);
59
- });
60
- test('1.e. Extract parts for 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 { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
65
- // Assert.
66
- expect(strSectionName).not.toEqual('nonCorrectName');
67
- expect(strMarkerChars).toEqual('^');
68
- expect(strSectionName).toEqual('SectionName');
69
- expect(strNumberPart).toEqual('');
70
- expect(isBacktickedName).toEqual(false);
71
- });
72
- test('2.a. Extract parts for classic section header with level 1 and backticked name.', () => {
73
- // Arrange.
74
- const fixture = '^ `Section Name`';
75
- // Act.
76
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
77
- // Assert.
78
- expect(strSectionName).not.toEqual('nonCorrectName');
79
- expect(strMarkerChars).toEqual('^');
80
- expect(strSectionName).toEqual('`Section Name`');
81
- expect(strNumberPart).toEqual('');
82
- expect(isBacktickedName).toEqual(true);
83
- });
84
- test('2.b. Extract parts for classic section header with level 1 with tabbed delimeter and backticked name.', () => {
85
- // Arrange.
86
- const fixture = '^\t`Section Name`';
87
- // Act.
88
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
89
- // Assert.
90
- expect(strSectionName).not.toEqual('nonCorrectName');
91
- expect(strMarkerChars).toEqual('^');
92
- expect(strSectionName).toEqual('`Section Name`');
93
- expect(strNumberPart).toEqual('');
94
- expect(isBacktickedName).toEqual(true);
95
- });
96
- test('2.c. Extract parts for classic section header with level 1 with multiple spaces and backticked name.', () => {
97
- // Arrange.
98
- const fixture = '^ `Section Name`';
99
- // Act.
100
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
101
- // Assert.
102
- expect(strSectionName).not.toEqual('nonCorrectName');
103
- expect(strMarkerChars).toEqual('^');
104
- expect(strSectionName).toEqual('`Section Name`');
105
- expect(strNumberPart).toEqual('');
106
- expect(isBacktickedName).toEqual(true);
107
- });
108
- test('2.d. Extract parts for classic section header with level 1 with any WS delimeters and backticked name.', () => {
109
- // Arrange.
110
- const fixture = '^\t \t `Section Name`';
111
- // Act.
112
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
113
- // Assert.
114
- expect(strSectionName).not.toEqual('nonCorrectName');
115
- expect(strMarkerChars).toEqual('^');
116
- expect(strSectionName).toEqual('`Section Name`');
117
- expect(strNumberPart).toEqual('');
118
- expect(isBacktickedName).toEqual(true);
119
- });
120
- test('2.e. Extract parts for classic section header with level 1 with a comment and any WS delimeters and backticked name.', () => {
121
- // Arrange.
122
- const fixture = '^\t \t `Section Name` # This part is a comment.';
123
- // Act.
124
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
125
- // Assert.
126
- expect(strSectionName).not.toEqual('nonCorrectName');
127
- expect(strMarkerChars).toEqual('^');
128
- expect(strSectionName).toEqual('`Section Name`');
129
- expect(strNumberPart).toEqual('');
130
- expect(isBacktickedName).toEqual(true);
131
- });
132
- test('3.a. Extract parts for classic section header with level 1, compact (no WS).', () => {
133
- // Arrange.
134
- const fixture = '^SectionName';
135
- // Act.
136
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
137
- // Assert.
138
- expect(strSectionName).not.toEqual('nonCorrectName');
139
- expect(strMarkerChars).toEqual('^');
140
- expect(strSectionName).toEqual('SectionName');
141
- expect(strNumberPart).toEqual('');
142
- expect(isBacktickedName).toEqual(false);
143
- });
144
- test('3.b. Extract parts for classic section header with level 1 with comment, compact (no WS).', () => {
145
- // Arrange.
146
- const fixture = '^SectionName // This is a section header.';
147
- // Act.
148
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
149
- // Assert.
150
- expect(strSectionName).not.toEqual('nonCorrectName');
151
- expect(strMarkerChars).toEqual('^');
152
- expect(strSectionName).toEqual('SectionName');
153
- expect(strNumberPart).toEqual('');
154
- expect(isBacktickedName).toEqual(false);
155
- });
156
- test('3.c. Extract parts for classic section header with level 1 with comment, compact (no WS).', () => {
157
- // Arrange.
158
- const fixture = '^SectionName # This part is a comment.';
159
- // Act.
160
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
161
- // Assert.
162
- expect(strSectionName).not.toEqual('nonCorrectName');
163
- expect(strMarkerChars).toEqual('^');
164
- expect(strSectionName).toEqual('SectionName');
165
- expect(strNumberPart).toEqual('');
166
- expect(isBacktickedName).toEqual(false);
167
- });
168
- test('3.d. Extract parts for classic section header with level 1 with comment, compact (no WS).', () => {
169
- // Arrange.
170
- const fixture = '^SectionName// This is a section header.';
171
- // Act.
172
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
173
- // Assert.
174
- expect(strSectionName).not.toEqual('nonCorrectName');
175
- expect(strMarkerChars).toEqual('^');
176
- expect(strSectionName).toEqual('SectionName');
177
- expect(strNumberPart).toEqual('');
178
- expect(isBacktickedName).toEqual(false);
179
- });
180
- test('3.e. Extract parts for classic section header with level 1 with comment, compact (no WS).', () => {
181
- // Arrange.
182
- const fixture = '^SectionName# This part is a comment.';
183
- // Act.
184
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
185
- // Assert.
186
- expect(strSectionName).not.toEqual('nonCorrectName');
187
- expect(strMarkerChars).toEqual('^');
188
- expect(strSectionName).toEqual('SectionName');
189
- expect(strNumberPart).toEqual('');
190
- expect(isBacktickedName).toEqual(false);
191
- });
192
- test('3.f. Extract parts for classic section header with level 1 enclosed in comments, compact (no WS).', () => {
193
- // Arrange.
194
- const fixture = `// This whole line is a comment.
195
- ^SectionName# This part is a comment.
196
- // This whole line is a comment.
197
- `;
198
- // Act.
199
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
200
- // Assert.
201
- expect(strSectionName).not.toEqual('nonCorrectName');
202
- expect(strMarkerChars).toEqual('^');
203
- expect(strSectionName).toEqual('SectionName');
204
- expect(strNumberPart).toEqual('');
205
- expect(isBacktickedName).toEqual(false);
206
- });
207
- test('4.a. Extract parts for classic section header with level 1, backticked name, compact (no WS).', () => {
208
- // Arrange.
209
- const fixture = '^`Section Name`';
210
- // Act.
211
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
212
- // Assert.
213
- expect(strSectionName).not.toEqual('nonCorrectName');
214
- expect(strMarkerChars).toEqual('^');
215
- expect(strSectionName).toEqual('`Section Name`');
216
- expect(strNumberPart).toEqual('');
217
- expect(isBacktickedName).toEqual(true);
218
- });
219
- test('4.b. Extract parts for classic section header with level 1 with backticked name and comment, compact (no WS).', () => {
220
- // Arrange.
221
- const fixture = '^`Section Name` // Comment.';
222
- // Act.
223
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
224
- // Assert.
225
- expect(strSectionName).not.toEqual('nonCorrectName');
226
- expect(strMarkerChars).toEqual('^');
227
- expect(strSectionName).toEqual('`Section Name`');
228
- expect(strNumberPart).toEqual('');
229
- expect(isBacktickedName).toEqual(true);
230
- });
231
- test('4.c. Extract parts for classic section header with level 1 with backticked name and comment, compact (no WS).', () => {
232
- // Arrange.
233
- const fixture = '^`Section Name` # Comment.';
234
- // Act.
235
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
236
- // Assert.
237
- expect(strSectionName).not.toEqual('nonCorrectName');
238
- expect(strMarkerChars).toEqual('^');
239
- expect(strSectionName).toEqual('`Section Name`');
240
- expect(strNumberPart).toEqual('');
241
- expect(isBacktickedName).toEqual(true);
242
- });
243
- test('4.d. Extract parts for classic section header with level 1 with backticked name and comment, compact (no WS).', () => {
244
- // Arrange.
245
- const fixture = '^`Section Name`// This part is a comment.';
246
- // Act.
247
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
248
- // Assert.
249
- expect(strSectionName).not.toEqual('nonCorrectName');
250
- expect(strMarkerChars).toEqual('^');
251
- expect(strSectionName).toEqual('`Section Name`');
252
- expect(strNumberPart).toEqual('');
253
- expect(isBacktickedName).toEqual(true);
254
- });
255
- test('5.a. Extract parts for classic section header with level 2.', () => {
256
- // Arrange.
257
- const fixture = '^^ SectionName';
258
- // Act.
259
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
260
- // Assert.
261
- expect(strSectionName).not.toEqual('nonCorrectName');
262
- expect(strMarkerChars).toEqual('^^');
263
- expect(strSectionName).toEqual('SectionName');
264
- expect(strNumberPart).toEqual('');
265
- expect(isBacktickedName).toEqual(false);
266
- });
267
- test('5.b. Extract parts for classic section header with level 2 and comment.', () => {
268
- // Arrange.
269
- const fixture = '^^ SectionName // This part is a comment.';
270
- // Act.
271
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
272
- // Assert.
273
- expect(strSectionName).not.toEqual('nonCorrectName');
274
- expect(strMarkerChars).toEqual('^^');
275
- expect(strSectionName).toEqual('SectionName');
276
- expect(strNumberPart).toEqual('');
277
- expect(isBacktickedName).toEqual(false);
278
- });
279
- test('6.a. Extract parts for classic section header with level 3.', () => {
280
- // Arrange.
281
- const fixture = '^^^ SectionName';
282
- // Act.
283
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
284
- // Assert.
285
- expect(strSectionName).not.toEqual('nonCorrectName');
286
- expect(strMarkerChars).toEqual('^^^');
287
- expect(strSectionName).toEqual('SectionName');
288
- expect(strNumberPart).toEqual('');
289
- expect(isBacktickedName).toEqual(false);
290
- });
291
- test('6.b. Extract parts for classic section header with level 3, compact (no WS).', () => {
292
- // Arrange.
293
- const fixture = '^^^SectionName';
294
- // Act.
295
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
296
- // Assert.
297
- expect(strSectionName).not.toEqual('nonCorrectName');
298
- expect(strMarkerChars).toEqual('^^^');
299
- expect(strSectionName).toEqual('SectionName');
300
- expect(strNumberPart).toEqual('');
301
- expect(isBacktickedName).toEqual(false);
302
- });
303
- test('7.a. Extract parts for classic section header with level 4.', () => {
304
- // Arrange.
305
- const fixture = '^^^^ SectionName';
306
- // Act.
307
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
308
- // Assert.
309
- expect(strSectionName).not.toEqual('nonCorrectName');
310
- expect(strMarkerChars).toEqual('^^^^');
311
- expect(strSectionName).toEqual('SectionName');
312
- expect(strNumberPart).toEqual('');
313
- expect(isBacktickedName).toEqual(false);
314
- });
315
- test('7.b. Extract parts for classic section header with level 4 with backticked name.', () => {
316
- // Arrange.
317
- const fixture = '^^^^ `Section Name`';
318
- // Act.
319
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
320
- // Assert.
321
- expect(strSectionName).not.toEqual('nonCorrectName');
322
- expect(strMarkerChars).toEqual('^^^^');
323
- expect(strSectionName).toEqual('`Section Name`');
324
- expect(strNumberPart).toEqual('');
325
- expect(isBacktickedName).toEqual(true);
326
- });
327
- test('8.a. Extract parts for classic section header with level 5.', () => {
328
- // Arrange.
329
- const fixture = '^^^^^ SectionName';
330
- // Act.
331
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
332
- // Assert.
333
- expect(strSectionName).not.toEqual('nonCorrectName');
334
- expect(strMarkerChars).toEqual('^^^^^');
335
- expect(strSectionName).toEqual('SectionName');
336
- expect(strNumberPart).toEqual('');
337
- expect(isBacktickedName).toEqual(false);
338
- });
339
- test('8.b. Extract parts for classic section header with level 5, with many WS.', () => {
340
- // Arrange.
341
- const fixture = '^^^^^ \tSectionName';
342
- // Act.
343
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
344
- // Assert.
345
- expect(strSectionName).not.toEqual('nonCorrectName');
346
- expect(strMarkerChars).toEqual('^^^^^');
347
- expect(strSectionName).toEqual('SectionName');
348
- expect(strNumberPart).toEqual('');
349
- expect(isBacktickedName).toEqual(false);
350
- });
351
- test('9.a. Extract parts for classic section header with level 6.', () => {
352
- // Arrange.
353
- const fixture = '^^^^^^ SectionName';
354
- // Act.
355
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
356
- // Assert.
357
- expect(strSectionName).not.toEqual('nonCorrectName');
358
- expect(strMarkerChars).toEqual('^^^^^^');
359
- expect(strSectionName).toEqual('SectionName');
360
- expect(strNumberPart).toEqual('');
361
- expect(isBacktickedName).toEqual(false);
362
- });
363
- test('9.b. Extract parts for classic section header with level 6, compact with backticed name and comment.', () => {
364
- // Arrange.
365
- const fixture = `;This line is comment.
366
- ^^^^^^\`Section Name\`//Comment here.
367
- ;This line is comment.
368
- `;
369
- // Act.
370
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
371
- (0, system_1.debugPrint)('strMarkerChars: ' + strMarkerChars);
372
- (0, system_1.debugPrint)('strSectionName: ' + strSectionName);
373
- (0, system_1.debugPrint)('strNumberPart: ' + strNumberPart);
374
- (0, system_1.debugPrint)('isBacktickedName: ' + isBacktickedName);
375
- // Assert.
376
- expect(strSectionName).not.toEqual('nonCorrectName');
377
- expect(strMarkerChars).toEqual('^^^^^^');
378
- expect(strSectionName).toEqual('`Section Name`');
379
- expect(strNumberPart).toEqual('');
380
- expect(isBacktickedName).toEqual(true);
381
- });
382
- test('10.a. Extract parts for classic section header with alternative marker (~), level 2 with any WS delimeters and backticked name.', () => {
383
- // Arrange.
384
- const fixture = '~~\t\t Title';
385
- // Act.
386
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
387
- // Assert.
388
- expect(strSectionName).not.toEqual('nonCorrectName');
389
- expect(strMarkerChars).toEqual('~~');
390
- expect(strSectionName).toEqual('Title');
391
- expect(strNumberPart).toEqual('');
392
- expect(isBacktickedName).toEqual(false);
393
- });
394
- test('10.b. Extract parts for classic section header with alternative marker (~), level 2 with any WS delimeters and backticked name.', () => {
395
- // Arrange.
396
- const fixture = '~~\t \t `Section Title`';
397
- // Act.
398
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
399
- // Assert.
400
- expect(strSectionName).not.toEqual('nonCorrectName');
401
- expect(strMarkerChars).toEqual('~~');
402
- expect(strSectionName).toEqual('`Section Title`');
403
- expect(strNumberPart).toEqual('');
404
- expect(isBacktickedName).toEqual(true);
405
- });
406
- test('10.c. Extract parts for classic section header with alternative marker (~), level 2 with any WS delimeters, backticked name and a comment.', () => {
407
- // Arrange.
408
- const fixture = '~~\t \t `Section Title` // This is a comment.';
409
- // Act.
410
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
411
- // Assert.
412
- expect(strSectionName).not.toEqual('nonCorrectName');
413
- expect(strMarkerChars).toEqual('~~');
414
- expect(strSectionName).toEqual('`Section Title`');
415
- expect(strNumberPart).toEqual('');
416
- expect(isBacktickedName).toEqual(true);
417
- });
418
- test('11.a. Extract parts for classic section header with alternative marker (§), level 1 with any WS delimeters and backticked name.', () => {
419
- // Arrange.
420
- const fixture = '§\t\t Title';
421
- // Act.
422
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
423
- // Assert.
424
- expect(strSectionName).not.toEqual('nonCorrectName');
425
- expect(strMarkerChars).toEqual('§');
426
- expect(strSectionName).toEqual('Title');
427
- expect(strNumberPart).toEqual('');
428
- expect(isBacktickedName).toEqual(false);
429
- });
430
- test('11.b. Extract parts for classic section header with alternative marker (§), level 2 with any WS delimeters and backticked name.', () => {
431
- // Arrange.
432
- const fixture = '§§\t \t `Section Title`';
433
- // Act.
434
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
435
- // Assert.
436
- expect(strSectionName).not.toEqual('nonCorrectName');
437
- expect(strMarkerChars).toEqual('§§');
438
- expect(strSectionName).toEqual('`Section Title`');
439
- expect(strNumberPart).toEqual('');
440
- expect(isBacktickedName).toEqual(true);
441
- });
442
- test('11.c. Extract parts for classic section header with alternative marker (§), level 3 with any WS delimeters, backticked name and a comment.', () => {
443
- // Arrange.
444
- const fixture = '§§§\t \t `Section Title` // This is a comment.';
445
- // Act.
446
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
447
- // Assert.
448
- expect(strSectionName).not.toEqual('nonCorrectName');
449
- expect(strMarkerChars).toEqual('§§§');
450
- expect(strSectionName).toEqual('`Section Title`');
451
- expect(strNumberPart).toEqual('');
452
- expect(isBacktickedName).toEqual(true);
453
- });
454
- test('12.a. Extract parts for classic section header with alternative marker (€), level 1 with any WS delimeters and backticked name.', () => {
455
- // Arrange.
456
- const fixture = '€\t\t Title';
457
- // Act.
458
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
459
- // Assert.
460
- expect(strSectionName).not.toEqual('nonCorrectName');
461
- expect(strMarkerChars).toEqual('€');
462
- expect(strSectionName).toEqual('Title');
463
- expect(strNumberPart).toEqual('');
464
- expect(isBacktickedName).toEqual(false);
465
- });
466
- test('12.b. Extract parts for classic section header with alternative marker (€), level 2 with any WS delimeters and backticked name.', () => {
467
- // Arrange.
468
- const fixture = '€€\t \t `Section Title`';
469
- // Act.
470
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
471
- // Assert.
472
- expect(strSectionName).not.toEqual('nonCorrectName');
473
- expect(strMarkerChars).toEqual('€€');
474
- expect(strSectionName).toEqual('`Section Title`');
475
- expect(strNumberPart).toEqual('');
476
- expect(isBacktickedName).toEqual(true);
477
- });
478
- test('12.c. Extract parts for classic section header with alternative marker (€), level 3 with any WS delimeters, backticked name and a comment.', () => {
479
- // Arrange.
480
- const fixture = '€€€\t \t `Section Title` // This is a comment.';
481
- // Act.
482
- const { strMarkerChars, strSectionName, strNumberPart, isBacktickedName, } = (0, extractHeaderParts_1.default)(fixture);
483
- // Assert.
484
- expect(strSectionName).not.toEqual('nonCorrectName');
485
- expect(strMarkerChars).toEqual('€€€');
486
- expect(strSectionName).toEqual('`Section Title`');
487
- expect(strNumberPart).toEqual('');
488
- expect(isBacktickedName).toEqual(true);
489
- });
490
- });