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.
- package/README.md +21 -10
- package/dist/YINI.d.ts +21 -0
- package/dist/{src/YINI.js → YINI.js} +7 -7
- package/dist/config/env.d.ts +20 -0
- package/dist/core/ErrorDataHandler.d.ts +60 -0
- package/dist/core/YINIVisitor.d.ts +149 -0
- package/dist/core/objectBuilder.d.ts +6 -0
- package/dist/core/types.d.ts +49 -0
- package/dist/grammar/YiniLexer.d.ts +68 -0
- package/dist/grammar/YiniParser.d.ts +284 -0
- package/dist/grammar/YiniParserVisitor.d.ts +143 -0
- package/dist/index.d.ts +1 -0
- package/dist/parseEntry.d.ts +2 -0
- package/dist/parsers/extractHeaderParts.d.ts +31 -0
- package/dist/parsers/extractSignificantYiniLine.d.ts +9 -0
- package/dist/parsers/parseBoolean.d.ts +5 -0
- package/dist/parsers/parseNull.d.ts +2 -0
- package/dist/parsers/parseNumber.d.ts +6 -0
- package/dist/parsers/parseSectionHeader.d.ts +13 -0
- package/dist/parsers/parseString.d.ts +2 -0
- package/dist/utils/pathAndFileName.d.ts +5 -0
- package/dist/utils/string.d.ts +42 -0
- package/dist/utils/system.d.ts +7 -0
- package/dist/yiniHelpers.d.ts +44 -0
- package/package.json +17 -18
- package/dist/tests/integration/1-core-parsing/parse-bigger-section-nesting-as-object.test.js +0 -83
- package/dist/tests/integration/1-core-parsing/parse-section-nesting-w-classic-markers.test.js +0 -170
- package/dist/tests/integration/1-core-parsing/parse-section-nesting-w-nsh-markers.test.js +0 -27
- package/dist/tests/integration/1-core-parsing/read some values from level 1 and 2.test.js +0 -77
- package/dist/tests/integration/1-core-parsing/throw on bad section heads.test.js +0 -162
- package/dist/tests/integration/10-special-validation-modes/validation-modes.test.js +0 -38
- package/dist/tests/integration/2-file-structure-and-error/able to parse mixed case filenames.test.js +0 -72
- package/dist/tests/integration/2-file-structure-and-error/throw error on bad file extensions.test.js +0 -36
- package/dist/tests/integration/2-file-structure-and-error/throw error parsing bad content.test.js +0 -80
- package/dist/tests/smoke/A-general-smoke.test.js +0 -259
- package/dist/tests/smoke/B-parse-inline-smoke.test.js +0 -270
- package/dist/tests/smoke/C-traverse-file-smoke.test.js +0 -141
- package/dist/tests/smoke/D-parse-file-smoke.test.js +0 -134
- package/dist/tests/unit/parsers/extractHeaderParts.unit.test.js +0 -490
- package/dist/tests/unit/parsers/parseSectionHeader-classic.unit.test.js +0 -421
- package/dist/tests/unit/parsers/parseSectionHeader-nsh.unit.test.js +0 -436
- package/dist/tests/unit/parsers/parseSectionHeader-throw-on-invalid.unit.test.js +0 -168
- package/dist/tests/unit/utils/utils-pathAndFileName.unit.test.js +0 -80
- package/dist/tests/unit/utils/utils-string.unit.test.js +0 -185
- package/dist/tests/unit/yiniHelpers.unit.test.js +0 -306
- /package/dist/{src/config → config}/env.js +0 -0
- /package/dist/{src/core → core}/ErrorDataHandler.js +0 -0
- /package/dist/{src/core → core}/YINIVisitor.js +0 -0
- /package/dist/{src/core → core}/objectBuilder.js +0 -0
- /package/dist/{src/core → core}/types.js +0 -0
- /package/dist/{src/grammar → grammar}/YiniLexer.js +0 -0
- /package/dist/{src/grammar → grammar}/YiniParser.js +0 -0
- /package/dist/{src/grammar → grammar}/YiniParserVisitor.js +0 -0
- /package/dist/{src/index.js → index.js} +0 -0
- /package/dist/{src/parseEntry.js → parseEntry.js} +0 -0
- /package/dist/{src/parsers → parsers}/extractHeaderParts.js +0 -0
- /package/dist/{src/parsers → parsers}/extractSignificantYiniLine.js +0 -0
- /package/dist/{src/parsers → parsers}/parseBoolean.js +0 -0
- /package/dist/{src/parsers → parsers}/parseNull.js +0 -0
- /package/dist/{src/parsers → parsers}/parseNumber.js +0 -0
- /package/dist/{src/parsers → parsers}/parseSectionHeader.js +0 -0
- /package/dist/{src/parsers → parsers}/parseString.js +0 -0
- /package/dist/{src/utils → utils}/pathAndFileName.js +0 -0
- /package/dist/{src/utils → utils}/string.js +0 -0
- /package/dist/{src/utils → utils}/system.js +0 -0
- /package/dist/{src/yiniHelpers.js → yiniHelpers.js} +0 -0
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const string_1 = require("../../../src/utils/string");
|
|
4
|
-
/**
|
|
5
|
-
* splitLines(..) Tests.
|
|
6
|
-
*/
|
|
7
|
-
describe('Utils-String: splitLines(..) Unit Tests:', () => {
|
|
8
|
-
test('1. splitLines(..) test.', () => {
|
|
9
|
-
// Arrange.
|
|
10
|
-
const fixture = 'line one';
|
|
11
|
-
// Act.
|
|
12
|
-
const result = (0, string_1.splitLines)(fixture);
|
|
13
|
-
// Assert.
|
|
14
|
-
expect(result[0]).toEqual('line one');
|
|
15
|
-
});
|
|
16
|
-
test('2. splitLines(..) test.', () => {
|
|
17
|
-
// Arrange.
|
|
18
|
-
const fixture = 'line one\n';
|
|
19
|
-
// Act.
|
|
20
|
-
const result = (0, string_1.splitLines)(fixture);
|
|
21
|
-
// Assert.
|
|
22
|
-
expect(result[0]).toEqual('line one');
|
|
23
|
-
});
|
|
24
|
-
test('3. splitLines(..) test.', () => {
|
|
25
|
-
// Arrange.
|
|
26
|
-
const fixture = 'line one\r line two\n';
|
|
27
|
-
// Act.
|
|
28
|
-
const result = (0, string_1.splitLines)(fixture);
|
|
29
|
-
// Assert.
|
|
30
|
-
expect(result[0]).toEqual('line one');
|
|
31
|
-
expect(result[1]).toEqual(' line two');
|
|
32
|
-
});
|
|
33
|
-
test('4. splitLines(..) test.', () => {
|
|
34
|
-
// Arrange.
|
|
35
|
-
const fixture = 'line one\nline two\r\nline three\rline four';
|
|
36
|
-
// Act.
|
|
37
|
-
const result = (0, string_1.splitLines)(fixture);
|
|
38
|
-
// Assert.
|
|
39
|
-
expect(result[0]).toEqual('line one');
|
|
40
|
-
expect(result[1]).toEqual('line two');
|
|
41
|
-
expect(result[2]).toEqual('line three');
|
|
42
|
-
expect(result[3]).toEqual('line four');
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
/**
|
|
46
|
-
* trimBackticks(..) Tests.
|
|
47
|
-
*/
|
|
48
|
-
describe('Utils-String: trimBackticks(..) Unit Tests:', () => {
|
|
49
|
-
test('1. Trim backticks test.', () => {
|
|
50
|
-
// Arrange.
|
|
51
|
-
const fixture = '`hello`';
|
|
52
|
-
// Act.
|
|
53
|
-
const result = (0, string_1.trimBackticks)(fixture);
|
|
54
|
-
// Assert.
|
|
55
|
-
expect(result).toEqual('hello');
|
|
56
|
-
});
|
|
57
|
-
test('2. Trim backticks test.', () => {
|
|
58
|
-
// Arrange.
|
|
59
|
-
const fixture = 'hello';
|
|
60
|
-
// Act.
|
|
61
|
-
const result = (0, string_1.trimBackticks)(fixture);
|
|
62
|
-
// Assert.
|
|
63
|
-
expect(result).toEqual('hello');
|
|
64
|
-
});
|
|
65
|
-
test('3. Trim backticks test.', () => {
|
|
66
|
-
// Arrange.
|
|
67
|
-
const fixture = '`hello';
|
|
68
|
-
// Act.
|
|
69
|
-
const result = (0, string_1.trimBackticks)(fixture);
|
|
70
|
-
// Assert.
|
|
71
|
-
expect(result).toEqual('`hello');
|
|
72
|
-
});
|
|
73
|
-
test('4. Trim backticks test.', () => {
|
|
74
|
-
// Arrange.
|
|
75
|
-
const fixture = 'hello`';
|
|
76
|
-
// Act.
|
|
77
|
-
const result = (0, string_1.trimBackticks)(fixture);
|
|
78
|
-
// Assert.
|
|
79
|
-
expect(result).toEqual('hello`');
|
|
80
|
-
});
|
|
81
|
-
test('5. Trim backticks test.', () => {
|
|
82
|
-
// Arrange.
|
|
83
|
-
const fixture = '';
|
|
84
|
-
// Act.
|
|
85
|
-
const result = (0, string_1.trimBackticks)(fixture);
|
|
86
|
-
// Assert.
|
|
87
|
-
expect(result).toEqual('');
|
|
88
|
-
});
|
|
89
|
-
test('6. Trim backticks test.', () => {
|
|
90
|
-
// Arrange.
|
|
91
|
-
const fixture = '``';
|
|
92
|
-
// Act.
|
|
93
|
-
const result = (0, string_1.trimBackticks)(fixture);
|
|
94
|
-
// Assert.
|
|
95
|
-
expect(result).toEqual('');
|
|
96
|
-
});
|
|
97
|
-
test('7. Trim backticks test.', () => {
|
|
98
|
-
// Arrange.
|
|
99
|
-
const fixture = '`H`';
|
|
100
|
-
// Act.
|
|
101
|
-
const result = (0, string_1.trimBackticks)(fixture);
|
|
102
|
-
// Assert.
|
|
103
|
-
expect(result).toEqual('H');
|
|
104
|
-
});
|
|
105
|
-
test('8. Trim backticks test.', () => {
|
|
106
|
-
// Arrange.
|
|
107
|
-
const fixture = '` `';
|
|
108
|
-
// Act.
|
|
109
|
-
const result = (0, string_1.trimBackticks)(fixture);
|
|
110
|
-
// Assert.
|
|
111
|
-
expect(result).toEqual(' ');
|
|
112
|
-
});
|
|
113
|
-
test('9. Trim backticks test.', () => {
|
|
114
|
-
// Arrange.
|
|
115
|
-
const fixture = '`Hello World`';
|
|
116
|
-
// Act.
|
|
117
|
-
const result = (0, string_1.trimBackticks)(fixture);
|
|
118
|
-
// Assert.
|
|
119
|
-
expect(result).toEqual('Hello World');
|
|
120
|
-
});
|
|
121
|
-
test('10. Trim backticks test.', () => {
|
|
122
|
-
// Arrange.
|
|
123
|
-
const fixture = 'Hello World';
|
|
124
|
-
// Act.
|
|
125
|
-
const result = (0, string_1.trimBackticks)(fixture);
|
|
126
|
-
// Assert.
|
|
127
|
-
expect(result).toEqual('Hello World');
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
/**
|
|
131
|
-
* stripNLAndAfter(..) Tests.
|
|
132
|
-
*/
|
|
133
|
-
describe('Utils-String: stripNLAndAfter(..) Unit Tests:', () => {
|
|
134
|
-
test('1. Strip NL-and-After test.', () => {
|
|
135
|
-
// Arrange.
|
|
136
|
-
const fixture = 'SectionName1';
|
|
137
|
-
// Act.
|
|
138
|
-
const result = (0, string_1.stripNLAndAfter)(fixture).trim();
|
|
139
|
-
// Assert.
|
|
140
|
-
expect(result).toEqual('SectionName1');
|
|
141
|
-
});
|
|
142
|
-
test('2. Strip NL-and-After test.', () => {
|
|
143
|
-
// Arrange.
|
|
144
|
-
const fixture = '';
|
|
145
|
-
// Act.
|
|
146
|
-
const result = (0, string_1.stripNLAndAfter)(fixture).trim();
|
|
147
|
-
// Assert.
|
|
148
|
-
expect(result).toEqual('');
|
|
149
|
-
});
|
|
150
|
-
test('3. Strip NL-and-After test.', () => {
|
|
151
|
-
// Arrange.
|
|
152
|
-
const fixture = `SectionName1 //value = 11`;
|
|
153
|
-
// Act.
|
|
154
|
-
const result = (0, string_1.stripNLAndAfter)(fixture).trim();
|
|
155
|
-
// Assert.
|
|
156
|
-
expect(result).toEqual('SectionName1 //value = 11');
|
|
157
|
-
});
|
|
158
|
-
test('4. Strip NL-and-After test.', () => {
|
|
159
|
-
// Arrange.
|
|
160
|
-
const fixture = `\`Section Name 2\`
|
|
161
|
-
//value = 11`;
|
|
162
|
-
// Act.
|
|
163
|
-
const result = (0, string_1.stripNLAndAfter)(fixture).trim();
|
|
164
|
-
// Assert.
|
|
165
|
-
expect(result).toEqual('\`Section Name 2\`');
|
|
166
|
-
});
|
|
167
|
-
test('5. Strip NL-and-After test.', () => {
|
|
168
|
-
// Arrange.
|
|
169
|
-
const fixture = ` SectionName3
|
|
170
|
-
//value = 11`;
|
|
171
|
-
// Act.
|
|
172
|
-
const result = (0, string_1.stripNLAndAfter)(fixture).trim();
|
|
173
|
-
// Assert.
|
|
174
|
-
expect(result).toEqual('SectionName3');
|
|
175
|
-
});
|
|
176
|
-
test('6. Strip NL-and-After test.', () => {
|
|
177
|
-
// Arrange.
|
|
178
|
-
const fixture = ` \`Section Name 4\`
|
|
179
|
-
//value = 11`;
|
|
180
|
-
// Act.
|
|
181
|
-
const result = (0, string_1.stripNLAndAfter)(fixture).trim();
|
|
182
|
-
// Assert.
|
|
183
|
-
expect(result).toEqual('\`Section Name 4\`');
|
|
184
|
-
});
|
|
185
|
-
});
|
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const yiniHelpers_1 = require("../../src/yiniHelpers");
|
|
4
|
-
/**
|
|
5
|
-
* stripCommentsAndAfter(..) Unit Tests.
|
|
6
|
-
*/
|
|
7
|
-
describe('yiniHelpers: stripCommentsAndAfter(..) Unit Tests:', () => {
|
|
8
|
-
test('1. tripCommentsAndAfter(..) test.', () => {
|
|
9
|
-
// Arrange.
|
|
10
|
-
const fixture = 'SectionName1 // This is a comment.';
|
|
11
|
-
// Act.
|
|
12
|
-
const result = (0, yiniHelpers_1.stripCommentsAndAfter)(fixture).trim();
|
|
13
|
-
// Assert.
|
|
14
|
-
expect(result).toEqual('SectionName1');
|
|
15
|
-
});
|
|
16
|
-
test('2. tripCommentsAndAfter(..) test.', () => {
|
|
17
|
-
// Arrange.
|
|
18
|
-
const fixture = '';
|
|
19
|
-
// Act.
|
|
20
|
-
const result = (0, yiniHelpers_1.stripCommentsAndAfter)(fixture).trim();
|
|
21
|
-
// Assert.
|
|
22
|
-
expect(result).toEqual('');
|
|
23
|
-
});
|
|
24
|
-
test('3. tripCommentsAndAfter(..) test.', () => {
|
|
25
|
-
// Arrange.
|
|
26
|
-
const fixture = 'SectionName1';
|
|
27
|
-
// Act.
|
|
28
|
-
const result = (0, yiniHelpers_1.stripCommentsAndAfter)(fixture).trim();
|
|
29
|
-
// Assert.
|
|
30
|
-
expect(result).toEqual('SectionName1');
|
|
31
|
-
});
|
|
32
|
-
test('4. tripCommentsAndAfter(..) test.', () => {
|
|
33
|
-
// Arrange.
|
|
34
|
-
const fixture = 'SectionName1 # This is a comment.';
|
|
35
|
-
// Act.
|
|
36
|
-
const result = (0, yiniHelpers_1.stripCommentsAndAfter)(fixture).trim();
|
|
37
|
-
// Assert.
|
|
38
|
-
expect(result).toEqual('SectionName1');
|
|
39
|
-
});
|
|
40
|
-
test('5. tripCommentsAndAfter(..) test.', () => {
|
|
41
|
-
// Arrange.
|
|
42
|
-
const fixture = 'SectionName1 // This is a comment.';
|
|
43
|
-
// Act.
|
|
44
|
-
const result = (0, yiniHelpers_1.stripCommentsAndAfter)(fixture).trim();
|
|
45
|
-
// Assert.
|
|
46
|
-
expect(result).toEqual('SectionName1');
|
|
47
|
-
});
|
|
48
|
-
test('6. tripCommentsAndAfter(..) test.', () => {
|
|
49
|
-
// Arrange.
|
|
50
|
-
const fixture = 'SectionName1# This is a comment.';
|
|
51
|
-
// Act.
|
|
52
|
-
const result = (0, yiniHelpers_1.stripCommentsAndAfter)(fixture).trim();
|
|
53
|
-
// Assert.
|
|
54
|
-
expect(result).toEqual('SectionName1');
|
|
55
|
-
});
|
|
56
|
-
test('7. tripCommentsAndAfter(..) test.', () => {
|
|
57
|
-
// Arrange.
|
|
58
|
-
const fixture = 'SectionName1//This is a comment.';
|
|
59
|
-
// Act.
|
|
60
|
-
const result = (0, yiniHelpers_1.stripCommentsAndAfter)(fixture).trim();
|
|
61
|
-
// Assert.
|
|
62
|
-
expect(result).toEqual('SectionName1');
|
|
63
|
-
});
|
|
64
|
-
test('8. tripCommentsAndAfter(..) test.', () => {
|
|
65
|
-
// Arrange.
|
|
66
|
-
const fixture = '--SectionName1//This is a comment.';
|
|
67
|
-
// Act.
|
|
68
|
-
const result = (0, yiniHelpers_1.stripCommentsAndAfter)(fixture).trim();
|
|
69
|
-
// Assert.
|
|
70
|
-
expect(result).toEqual('');
|
|
71
|
-
});
|
|
72
|
-
test('9. tripCommentsAndAfter(..) test.', () => {
|
|
73
|
-
// Arrange.
|
|
74
|
-
const fixture = '; This is a comment line.';
|
|
75
|
-
// Act.
|
|
76
|
-
const result = (0, yiniHelpers_1.stripCommentsAndAfter)(fixture).trim();
|
|
77
|
-
// Assert.
|
|
78
|
-
expect(result).toEqual('');
|
|
79
|
-
});
|
|
80
|
-
test('10. tripCommentsAndAfter(..) test.', () => {
|
|
81
|
-
// Arrange.
|
|
82
|
-
const fixture = ';This is a comment line.';
|
|
83
|
-
// Act.
|
|
84
|
-
const result = (0, yiniHelpers_1.stripCommentsAndAfter)(fixture).trim();
|
|
85
|
-
// Assert.
|
|
86
|
-
expect(result).toEqual('');
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
/**
|
|
90
|
-
* isValidSimpleIdent(..) Unit Tests.
|
|
91
|
-
*/
|
|
92
|
-
describe('yiniHelpers: isValidSimpleIdent(..) Unit Tests:', () => {
|
|
93
|
-
test('1. isValidSimpleIdent(..) should be true.', () => {
|
|
94
|
-
// Arrange.
|
|
95
|
-
const fixture = 'foo';
|
|
96
|
-
// Act.
|
|
97
|
-
const result = (0, yiniHelpers_1.isValidSimpleIdent)(fixture);
|
|
98
|
-
// Assert.
|
|
99
|
-
expect(result).toEqual(true);
|
|
100
|
-
});
|
|
101
|
-
test('2. isValidSimpleIdent(..) should be true.', () => {
|
|
102
|
-
// Arrange.
|
|
103
|
-
const fixture = '_bar42';
|
|
104
|
-
// Act.
|
|
105
|
-
const result = (0, yiniHelpers_1.isValidSimpleIdent)(fixture);
|
|
106
|
-
// Assert.
|
|
107
|
-
expect(result).toEqual(true);
|
|
108
|
-
});
|
|
109
|
-
test('3. isValidSimpleIdent(..) should be true.', () => {
|
|
110
|
-
// Arrange.
|
|
111
|
-
const fixture = 'x';
|
|
112
|
-
// Act.
|
|
113
|
-
const result = (0, yiniHelpers_1.isValidSimpleIdent)(fixture);
|
|
114
|
-
// Assert.
|
|
115
|
-
expect(result).toEqual(true);
|
|
116
|
-
});
|
|
117
|
-
test('4. isValidSimpleIdent(..) should be true.', () => {
|
|
118
|
-
// Arrange.
|
|
119
|
-
const fixture = 'y2_';
|
|
120
|
-
// Act.
|
|
121
|
-
const result = (0, yiniHelpers_1.isValidSimpleIdent)(fixture);
|
|
122
|
-
// Assert.
|
|
123
|
-
expect(result).toEqual(true);
|
|
124
|
-
});
|
|
125
|
-
test('5. isValidSimpleIdent(..) should be false.', () => {
|
|
126
|
-
// Arrange.
|
|
127
|
-
const fixture = '9abc';
|
|
128
|
-
// Act.
|
|
129
|
-
const result = (0, yiniHelpers_1.isValidSimpleIdent)(fixture);
|
|
130
|
-
// Assert.
|
|
131
|
-
expect(result).toEqual(false);
|
|
132
|
-
});
|
|
133
|
-
test('6. isValidSimpleIdent(..) should be false.', () => {
|
|
134
|
-
// Arrange.
|
|
135
|
-
const fixture = 'ab-cd';
|
|
136
|
-
// Act.
|
|
137
|
-
const result = (0, yiniHelpers_1.isValidSimpleIdent)(fixture);
|
|
138
|
-
// Assert.
|
|
139
|
-
expect(result).toEqual(false);
|
|
140
|
-
});
|
|
141
|
-
test('7. isValidSimpleIdent(..) should be false.', () => {
|
|
142
|
-
// Arrange.
|
|
143
|
-
const fixture = '3';
|
|
144
|
-
// Act.
|
|
145
|
-
const result = (0, yiniHelpers_1.isValidSimpleIdent)(fixture);
|
|
146
|
-
// Assert.
|
|
147
|
-
expect(result).toEqual(false);
|
|
148
|
-
});
|
|
149
|
-
test('8. isValidSimpleIdent(..) should be false.', () => {
|
|
150
|
-
// Arrange.
|
|
151
|
-
const fixture = 'foo ';
|
|
152
|
-
// Act.
|
|
153
|
-
const result = (0, yiniHelpers_1.isValidSimpleIdent)(fixture);
|
|
154
|
-
// Assert.
|
|
155
|
-
expect(result).toEqual(false);
|
|
156
|
-
});
|
|
157
|
-
test('9. isValidSimpleIdent(..) should be false.', () => {
|
|
158
|
-
// Arrange.
|
|
159
|
-
const fixture = 'foo bar';
|
|
160
|
-
// Act.
|
|
161
|
-
const result = (0, yiniHelpers_1.isValidSimpleIdent)(fixture);
|
|
162
|
-
// Assert.
|
|
163
|
-
expect(result).toEqual(false);
|
|
164
|
-
});
|
|
165
|
-
test('10. isValidSimpleIdent(..) should be false.', () => {
|
|
166
|
-
// Arrange.
|
|
167
|
-
const fixture = 'ab.cd';
|
|
168
|
-
// Act.
|
|
169
|
-
const result = (0, yiniHelpers_1.isValidSimpleIdent)(fixture);
|
|
170
|
-
// Assert.
|
|
171
|
-
expect(result).toEqual(false);
|
|
172
|
-
});
|
|
173
|
-
test('11. Should throw error if isValidSimpleIdent(..) received an empty string.', () => {
|
|
174
|
-
// Arrange.
|
|
175
|
-
const fixture = '';
|
|
176
|
-
// Act & Assert.
|
|
177
|
-
expect(() => {
|
|
178
|
-
(0, yiniHelpers_1.isValidSimpleIdent)(fixture);
|
|
179
|
-
}).toThrow();
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
/**
|
|
183
|
-
* isValidBacktickedIdent(..) Unit Tests.
|
|
184
|
-
*/
|
|
185
|
-
describe('yiniHelpers: isValidBacktickedIdent(..) Unit Tests:', () => {
|
|
186
|
-
test('1. isValidBacktickedIdent(..) should be true.', () => {
|
|
187
|
-
// Arrange.
|
|
188
|
-
const fixture = '`SectionName`';
|
|
189
|
-
// Act.
|
|
190
|
-
const result = (0, yiniHelpers_1.isValidBacktickedIdent)(fixture);
|
|
191
|
-
// Assert.
|
|
192
|
-
expect(result).toEqual(true);
|
|
193
|
-
});
|
|
194
|
-
test('2. isValidBacktickedIdent(..) with a space should be true.', () => {
|
|
195
|
-
// Arrange.
|
|
196
|
-
const fixture = '`Section Name`';
|
|
197
|
-
// Act.
|
|
198
|
-
const result = (0, yiniHelpers_1.isValidBacktickedIdent)(fixture);
|
|
199
|
-
// Assert.
|
|
200
|
-
expect(result).toEqual(true);
|
|
201
|
-
});
|
|
202
|
-
test('3. isValidBacktickedIdent(..) with a dash should be true.', () => {
|
|
203
|
-
// Arrange.
|
|
204
|
-
const fixture = '`Section-Name`';
|
|
205
|
-
// Act.
|
|
206
|
-
const result = (0, yiniHelpers_1.isValidBacktickedIdent)(fixture);
|
|
207
|
-
// Assert.
|
|
208
|
-
expect(result).toEqual(true);
|
|
209
|
-
});
|
|
210
|
-
test('4. isValidBacktickedIdent(..) with spaces should be true.', () => {
|
|
211
|
-
// Arrange.
|
|
212
|
-
const fixture = '`Description of Project`';
|
|
213
|
-
// Act.
|
|
214
|
-
const result = (0, yiniHelpers_1.isValidBacktickedIdent)(fixture);
|
|
215
|
-
// Assert.
|
|
216
|
-
expect(result).toEqual(true);
|
|
217
|
-
});
|
|
218
|
-
test('5. isValidBacktickedIdent(..) should be true.', () => {
|
|
219
|
-
// Arrange.
|
|
220
|
-
const fixture = "`Amanda's Project`";
|
|
221
|
-
// Act.
|
|
222
|
-
const result = (0, yiniHelpers_1.isValidBacktickedIdent)(fixture);
|
|
223
|
-
// Assert.
|
|
224
|
-
expect(result).toEqual(true);
|
|
225
|
-
});
|
|
226
|
-
test('6. isValidBacktickedIdent(..) with escaped newline should be true.', () => {
|
|
227
|
-
// Arrange.
|
|
228
|
-
const fixture = '`Line1\\nLine2`'; // NOTE: Escaped newline in Yini!
|
|
229
|
-
// Act.
|
|
230
|
-
const result = (0, yiniHelpers_1.isValidBacktickedIdent)(fixture);
|
|
231
|
-
// Assert.
|
|
232
|
-
expect(result).toEqual(true);
|
|
233
|
-
});
|
|
234
|
-
test('7. isValidBacktickedIdent(..) with escaped tab should be true.', () => {
|
|
235
|
-
// Arrange.
|
|
236
|
-
const fixture = '`With\\tTab`'; // NOTE: Escaped tab in Yini!
|
|
237
|
-
// Act.
|
|
238
|
-
const result = (0, yiniHelpers_1.isValidBacktickedIdent)(fixture);
|
|
239
|
-
// Assert.
|
|
240
|
-
expect(result).toEqual(true);
|
|
241
|
-
});
|
|
242
|
-
test('8. isValidBacktickedIdent(..) with empty (``) should be true.', () => {
|
|
243
|
-
// Arrange.
|
|
244
|
-
const fixture = '``'; // Empty is allowed: ``, as in spec (due to conform with the JSON empty key "").
|
|
245
|
-
// Act.
|
|
246
|
-
const result = (0, yiniHelpers_1.isValidBacktickedIdent)(fixture);
|
|
247
|
-
// Assert.
|
|
248
|
-
expect(result).toEqual(true);
|
|
249
|
-
});
|
|
250
|
-
test('9. isValidBacktickedIdent(..) with a raw newline should be false.', () => {
|
|
251
|
-
// Arrange.
|
|
252
|
-
const fixture = '`Line1\nLine2`'; // false (raw newline).
|
|
253
|
-
// Act.
|
|
254
|
-
const result = (0, yiniHelpers_1.isValidBacktickedIdent)(fixture);
|
|
255
|
-
// Assert.
|
|
256
|
-
expect(result).toEqual(false);
|
|
257
|
-
});
|
|
258
|
-
test('10. isValidBacktickedIdent(..) with a raw newline should be false.', () => {
|
|
259
|
-
// Arrange.
|
|
260
|
-
const fixture = '`Line1\n`'; // false (raw newline).
|
|
261
|
-
// Act.
|
|
262
|
-
const result = (0, yiniHelpers_1.isValidBacktickedIdent)(fixture);
|
|
263
|
-
// Assert.
|
|
264
|
-
expect(result).toEqual(false);
|
|
265
|
-
});
|
|
266
|
-
test('11. isValidBacktickedIdent(..) with a raw tab should be false.', () => {
|
|
267
|
-
// Arrange.
|
|
268
|
-
const fixture = '`Project\tTitle`'; // false (raw tab).
|
|
269
|
-
// Act.
|
|
270
|
-
const result = (0, yiniHelpers_1.isValidBacktickedIdent)(fixture);
|
|
271
|
-
// Assert.
|
|
272
|
-
expect(result).toEqual(false);
|
|
273
|
-
});
|
|
274
|
-
test('12. isValidBacktickedIdent(..) with a raw tab should be false.', () => {
|
|
275
|
-
// Arrange.
|
|
276
|
-
const fixture = '`\tTitle`'; // false (raw tab).
|
|
277
|
-
// Act.
|
|
278
|
-
const result = (0, yiniHelpers_1.isValidBacktickedIdent)(fixture);
|
|
279
|
-
// Assert.
|
|
280
|
-
expect(result).toEqual(false);
|
|
281
|
-
});
|
|
282
|
-
test('13. Should throw error if isValidBacktickedIdent(..) missing backticks.', () => {
|
|
283
|
-
// Arrange.
|
|
284
|
-
const fixture = 'SectionName';
|
|
285
|
-
// Act & Assert.
|
|
286
|
-
expect(() => {
|
|
287
|
-
(0, yiniHelpers_1.isValidBacktickedIdent)(fixture);
|
|
288
|
-
}).toThrow();
|
|
289
|
-
});
|
|
290
|
-
test('14. Should throw error if isValidBacktickedIdent(..) missing start backtick.', () => {
|
|
291
|
-
// Arrange.
|
|
292
|
-
const fixture = 'SectionName`';
|
|
293
|
-
// Act & Assert.
|
|
294
|
-
expect(() => {
|
|
295
|
-
(0, yiniHelpers_1.isValidBacktickedIdent)(fixture);
|
|
296
|
-
}).toThrow();
|
|
297
|
-
});
|
|
298
|
-
test('15. Should throw error if isValidBacktickedIdent(..) missing end backtick.', () => {
|
|
299
|
-
// Arrange.
|
|
300
|
-
const fixture = '`SectionName';
|
|
301
|
-
// Act & Assert.
|
|
302
|
-
expect(() => {
|
|
303
|
-
(0, yiniHelpers_1.isValidBacktickedIdent)(fixture);
|
|
304
|
-
}).toThrow();
|
|
305
|
-
});
|
|
306
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|