Skip to content

Commit 7cf843c

Browse files
committed
test: Add descriptive names to tests with issue references
1 parent 9cf06d2 commit 7cf843c

File tree

7 files changed

+86
-88
lines changed

7 files changed

+86
-88
lines changed

tests/cst.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ describe('CST.visit', () => {
196196
})
197197
})
198198

199-
test('Line comment before unindented block-seq in block-map (eemeli/yaml#525)', () => {
199+
test('Line comment before unindented block-seq in block-map (#525)', () => {
200200
const src = 'a:\n#\n- b'
201201
const [doc] = Array.from(new Parser().parse(src))
202202
expect(CST.stringify(doc)).toBe(src)

tests/doc/comments.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ describe('stringify comments', () => {
597597
`)
598598
})
599599

600-
test('line comment after flow collection (eemeli/yaml#443)', () => {
600+
test('line comment after flow collection (#443)', () => {
601601
const doc = YAML.parseDocument(source`
602602
[ value1, value2 ] # comment
603603
`)
@@ -847,7 +847,7 @@ describe('blank lines', () => {
847847
})
848848
})
849849

850-
test('blank line after less-indented comment (eemeli/yaml#91)', () => {
850+
test('blank line after less-indented comment (#91)', () => {
851851
const src = `
852852
map:
853853
foo0:
@@ -1088,7 +1088,7 @@ map:
10881088
})
10891089
})
10901090

1091-
test('eemeli/yaml#277', () => {
1091+
test('trailing comment with trailing empty line (#277)', () => {
10921092
const src = source`
10931093
environment:
10941094
### SESSION START ###
@@ -1107,7 +1107,7 @@ map:
11071107
})
11081108
})
11091109

1110-
describe('eemeli/yaml#18', () => {
1110+
describe('comment after mapping key (#18)', () => {
11111111
test('reported', () => {
11121112
const src = `test1:
11131113
foo:
@@ -1124,7 +1124,7 @@ describe('eemeli/yaml#18', () => {
11241124
})
11251125
})
11261126

1127-
describe('eemeli/yaml#28', () => {
1127+
describe('trailing comments on collection (#28)', () => {
11281128
test('reported', () => {
11291129
const src = `# This comment is ok
11301130
entryA:

tests/doc/errors.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ describe('tabs as indentation', () => {
1919
})
2020
})
2121

22-
test('eemeli/yaml#6', () => {
22+
test('end with missing block map : indicator (#6)', () => {
2323
const src = 'abc: 123\ndef'
2424
const doc = YAML.parseDocument(src)
2525
expect(doc.errors).toMatchObject([{ pos: [9, 12] }])
2626
})
2727

28-
describe('eemeli/yaml#7', () => {
28+
describe('multiple trailing commas (#7)', () => {
2929
test('map', () => {
3030
const src = '{ , }\n---\n{ 123,,, }\n'
3131
const docs = YAML.parseAllDocuments(src)
@@ -132,7 +132,7 @@ describe('block collections', () => {
132132
])
133133
})
134134

135-
test('key after long comment on empty value (eemeli/yaml#413)', () => {
135+
test('key after long comment on empty value (#413)', () => {
136136
const doc = YAML.parseDocument(source`
137137
one:
138138
# large block of text, large block of text, large block of text, large block of text, large block of text,
@@ -150,7 +150,7 @@ describe('block collections', () => {
150150
expect(doc.errors).toMatchObject([])
151151
})
152152

153-
test('key after long comment on block map (eemeli/yaml#413)', () => {
153+
test('key after long comment on block map (#413)', () => {
154154
const doc = YAML.parseDocument(source`
155155
one:
156156
sub: a
@@ -169,7 +169,7 @@ describe('block collections', () => {
169169
expect(doc.errors).toMatchObject([])
170170
})
171171

172-
test('key after long comment on block seq (eemeli/yaml#413)', () => {
172+
test('key after long comment on block seq (#413)', () => {
173173
const doc = YAML.parseDocument(source`
174174
one:
175175
- a
@@ -190,12 +190,12 @@ describe('block collections', () => {
190190
})
191191

192192
describe('flow collections', () => {
193-
test('start only of flow map (eemeli/yaml#8)', () => {
193+
test('start only of flow map (#8)', () => {
194194
const doc = YAML.parseDocument('{')
195195
expect(doc.errors).toMatchObject([{ code: 'MISSING_CHAR', pos: [1, 2] }])
196196
})
197197

198-
test('start only of flow sequence (eemeli/yaml#8)', () => {
198+
test('start only of flow sequence (#8)', () => {
199199
const doc = YAML.parseDocument('[')
200200
expect(doc.errors).toMatchObject([{ code: 'MISSING_CHAR', pos: [1, 2] }])
201201
})
@@ -270,7 +270,7 @@ describe('comments', () => {
270270
})
271271

272272
describe('pretty errors', () => {
273-
test('eemeli/yaml#6', () => {
273+
test('end with missing block map : indicator (#6)', () => {
274274
const src = 'abc: 123\ndef'
275275
const doc = YAML.parseDocument(src, { prettyErrors: true })
276276
expect(doc.errors).toMatchObject([
@@ -292,7 +292,7 @@ describe('pretty errors', () => {
292292
expect(doc.errors[0]).not.toHaveProperty('source')
293293
})
294294

295-
test('eemeli/yaml#7 maps', () => {
295+
test('multiple trailing commas in mappings (#7)', () => {
296296
const src = '{ , }\n---\n{ 123,,, }\n'
297297
const docs = YAML.parseAllDocuments(src, { prettyErrors: true })
298298
expect(docs[0].errors).toMatchObject([

tests/doc/foldFlowLines.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ describe('double-quoted', () => {
145145
})
146146

147147
describe('Folding double-quoted strings', () => {
148-
describe('eemeli/yaml#48: Split \\" escape in double-quoted string', () => {
148+
describe('Split \\" escape in double-quoted string (#48)', () => {
149149
test('minimal', () => {
150150
const src2 = '"01234567\\""'
151151
expect(fold(src2, '', FOLD_QUOTED, options)).toBe('"01234567\\\n\\""')
@@ -163,27 +163,25 @@ describe('double-quoted', () => {
163163
})
164164
})
165165

166-
describe('eemeli/yaml#57', () => {
167-
test('minimal', () => {
166+
describe('Fold on multiple escaped characters', () => {
167+
test('minimal (#57)', () => {
168168
const str = `"0123\\"\\\\ '"`
169169
expect(fold(str, '', FOLD_QUOTED, options)).toBe(`"0123\\"\\\\\n'"`)
170170
})
171171

172-
test('reported', () => {
172+
test('reported (#57)', () => {
173173
const key2 = `!""""""""""""""""""""""""""""""""""#"\\ '`
174174
const str = YAML.stringify([{ key2 }])
175175
const res = YAML.parse(str)
176176
expect(res[0].key2).toBe(key2)
177177
})
178-
})
179-
180-
describe('eemeli/yaml#59', () => {
181-
test('minimal', () => {
178+
179+
test('minimal (#59)', () => {
182180
const str = `"######\\\\P#"`
183181
expect(fold(str, '', FOLD_QUOTED, options)).toBe(`"######\\\\\\\nP#"`)
184182
})
185183

186-
test('reported', () => {
184+
test('reported (#59)', () => {
187185
const value =
188186
'>####################################"##########################\'####\\P#'
189187
const str = YAML.stringify({ key: [[value]] })
@@ -193,7 +191,7 @@ describe('double-quoted', () => {
193191
})
194192
})
195193

196-
describe('awslabs/cdk8s#494', () => {
194+
describe('Fold on escaped character (awslabs/cdk8s#494)', () => {
197195
test('slash', () => {
198196
const str = `"1234567\\\\ab"`
199197
expect(fold(str, '', FOLD_QUOTED, options)).toBe(`"1234567\\\n\\\\ab"`)
@@ -211,7 +209,7 @@ describe('double-quoted', () => {
211209
})
212210
})
213211

214-
describe('Folding input with excessive start indentation - eemeli/yaml#196', () => {
212+
describe('Folding input with excessive start indentation (#196)', () => {
215213
test('quoted', () => {
216214
options.indentAtStart = 6
217215
options.minContentWidth = 6
@@ -251,7 +249,7 @@ describe('double-quoted', () => {
251249
})
252250

253251
describe('block scalar', () => {
254-
test('eemeli/yaml#422', () => {
252+
test('Indented first line (#422)', () => {
255253
const obj = {
256254
'nginx.ingress.kubernetes.io/configuration-snippet': source`
257255
location ~* ^/sites/aaaaaaa.aa/files/(.+) {
@@ -319,7 +317,7 @@ describe('end-to-end', () => {
319317
expect(doc.toString(foldOptions)).toBe(src)
320318
})
321319

322-
test('eemeli/yaml#55', () => {
320+
test('More-indented first line (#55)', () => {
323321
const str = ' first more-indented line\nnext line\n'
324322
const ys = YAML.stringify(str, foldOptions)
325323
expect(ys).toBe('>1\n first more-indented line\nnext line\n')

tests/doc/parse.ts

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,7 @@ describe('scalars', () => {
1515
})
1616
})
1717

18-
test('eemeli/yaml#3', () => {
19-
const src = '{ ? : 123 }'
20-
const doc = YAML.parseDocument<any>(src)
21-
expect(doc.errors).toHaveLength(0)
22-
expect(doc.contents.items[0].key.value).toBeNull()
23-
expect(doc.contents.items[0].value.value).toBe(123)
24-
})
25-
26-
describe('eemeli/yaml#10', () => {
18+
describe('indented block sequence (#10)', () => {
2719
test('reported', () => {
2820
const src = `
2921
aliases:
@@ -154,7 +146,7 @@ aliases:
154146
})
155147
})
156148

157-
test('buffer as source (eemeli/yaml#459)', () => {
149+
test('buffer as source (#459)', () => {
158150
const buffer = readFileSync(
159151
resolve(__dirname, '../artifacts/prettier-circleci-config.yml')
160152
)
@@ -163,39 +155,8 @@ test('buffer as source (eemeli/yaml#459)', () => {
163155
)
164156
})
165157

166-
describe('eemeli/yaml#19', () => {
167-
test('map', () => {
168-
const src = 'a:\n # 123'
169-
const doc = YAML.parseDocument(src)
170-
expect(String(doc)).toBe('a: # 123\n')
171-
})
172-
173-
test('seq', () => {
174-
const src = '- a: # 123'
175-
const doc = YAML.parseDocument(src)
176-
expect(String(doc)).toBe('- a: # 123\n')
177-
})
178-
})
179-
180-
test('eemeli/yaml#32', () => {
181-
expect(YAML.parse('[ ? ]')).toEqual([{ '': null }])
182-
expect(YAML.parse('[? 123]')).toEqual([{ 123: null }])
183-
expect(YAML.parse('[ 123, ? ]')).toEqual([123, { '': null }])
184-
expect(YAML.parse('[ 123, ? 456 ]')).toEqual([123, { 456: null }])
185-
})
186-
187-
describe('block scalars', () => {
188-
test('eemeli/yaml#34', () => {
189-
expect(YAML.parse('|')).toEqual('')
190-
})
191-
192-
test('eemeli/yaml#313', () => {
193-
expect(YAML.parse('|+\n \n\n \n')).toEqual('\n\n\n')
194-
})
195-
})
196-
197-
test('eemeli/yaml#36', () => {
198-
expect(() => YAML.parse(`{ x: ${'x'.repeat(1024)} }`)).not.toThrowError()
158+
test('long scalar value in flow map (#36)', () => {
159+
expect(() => YAML.parse(`{ x: ${'x'.repeat(1024)} }`)).not.toThrow()
199160
})
200161

201162
describe('flow collection keys', () => {
@@ -275,7 +236,7 @@ describe('flow collection keys', () => {
275236
})
276237
})
277238

278-
test('eemeli/yaml#38', () => {
239+
test('indented block sequnce with inner block sequence (#38)', () => {
279240
const src = `
280241
content:
281242
arrayOfArray:
@@ -305,7 +266,7 @@ test('eemeli/yaml#38', () => {
305266
})
306267
})
307268

308-
test('eemeli/yaml#120', () => {
269+
test('stream end after : indicator (#120)', () => {
309270
const src = `test:
310271
- test1: test1
311272
test2:`
@@ -314,7 +275,7 @@ test('eemeli/yaml#120', () => {
314275
})
315276
})
316277

317-
test('comment between key & : in flow collection (eemeli/yaml#149)', () => {
278+
test('comment between key & : in flow collection (#149)', () => {
318279
const src1 = '{"a"\n#c\n:1}'
319280
expect(YAML.parse(src1)).toEqual({ a: 1 })
320281

@@ -323,7 +284,7 @@ test('comment between key & : in flow collection (eemeli/yaml#149)', () => {
323284
expect(doc.errors).toMatchObject([{ code: 'MISSING_CHAR' }])
324285
})
325286

326-
describe('indented key with anchor (eemeli/yaml#378)', () => {
287+
describe('indented key with anchor (#378)', () => {
327288
test('followed by value', () => {
328289
const src1 = '&a foo: 1\n&b bar: 2'
329290
expect(YAML.parse(src1)).toEqual({ foo: 1, bar: 2 })
@@ -344,6 +305,45 @@ describe('indented key with anchor (eemeli/yaml#378)', () => {
344305
})
345306

346307
describe('empty(ish) nodes', () => {
308+
test('empty explicit key (#3)', () => {
309+
const src = '{ ? : 123 }'
310+
const doc = YAML.parseDocument<any>(src)
311+
expect(doc.errors).toHaveLength(0)
312+
expect(doc.contents.items[0].key.value).toBeNull()
313+
expect(doc.contents.items[0].value.value).toBe(123)
314+
})
315+
316+
describe('comment on empty pair value (#19)', () => {
317+
test('map', () => {
318+
const src = 'a:\n # 123'
319+
const doc = YAML.parseDocument(src)
320+
expect(String(doc)).toBe('a: # 123\n')
321+
})
322+
323+
test('seq', () => {
324+
const src = '- a: # 123'
325+
const doc = YAML.parseDocument(src)
326+
expect(String(doc)).toBe('- a: # 123\n')
327+
})
328+
})
329+
330+
test('explicit key with empty value (#32)', () => {
331+
expect(YAML.parse('[ ? ]')).toEqual([{ '': null }])
332+
expect(YAML.parse('[? 123]')).toEqual([{ 123: null }])
333+
expect(YAML.parse('[ 123, ? ]')).toEqual([123, { '': null }])
334+
expect(YAML.parse('[ 123, ? 456 ]')).toEqual([123, { 456: null }])
335+
})
336+
337+
describe('empty block scalars', () => {
338+
test('no body (#34)', () => {
339+
expect(YAML.parse('|')).toEqual('')
340+
})
341+
342+
test('whitespace with indents (#313)', () => {
343+
expect(YAML.parse('|+\n \n\n \n')).toEqual('\n\n\n')
344+
})
345+
})
346+
347347
test('empty node position', () => {
348348
const doc = YAML.parseDocument<any>('\r\na: # 123\r\n')
349349
const empty = doc.contents.items[0].value
@@ -699,7 +699,7 @@ describe('keepSourceTokens', () => {
699699
})
700700
}
701701

702-
test('allow for CST modifications (eemeli/yaml#903)', () => {
702+
test('allow for CST modifications (#903)', () => {
703703
const src = 'foo:\n [ 42 ]'
704704
const tokens = Array.from(new YAML.Parser().parse(src))
705705
const docs = new YAML.Composer<YAML.ParsedNode, false>({

0 commit comments

Comments
 (0)