Add variable documentation
[sheep] / src / test / failures.lisp
1 (in-package #:docgen-test)
2
3 (let
4  ((long-line (format nil "~A~A"
5               "This second section uses PATH and X as something we should talk about, "
6               "but doesn't use all the arguments (let's include PATH here for fun)")))
7  (deffailure-func-test
8   "Long line"
9   (format nil "UNUSED => RESULT
10
11 ARGUMENTS AND VALUES:
12
13   RESULT: a pathname
14
15 DESCRIPTION:
16
17   ~A"
18    long-line)
19   (format nil "Longer than 120 chars:   ~A" long-line)))
20
21 (deffailure-func-test
22  "Blank line - after args and vals"
23  "UNUSED => RESULT
24
25 ARGUMENTS AND VALUES:
26   RESULT: a pathname
27
28 DESCRIPTION:
29
30 "
31  "Expected blank line after: ARGUMENTS AND VALUES:")
32
33 (deffailure-func-test
34  "Blank line - after description"
35  "UNUSED => RESULT
36
37 ARGUMENTS AND VALUES:
38
39   RESULT: a pathname
40
41 DESCRIPTION:
42   Fail here
43
44 "
45  "Expected blank line after: DESCRIPTION:")
46
47 (deffailure-func-test
48  "Blank line - after examples"
49  "UNUSED => RESULT
50
51 ARGUMENTS AND VALUES:
52
53   RESULT: a pathname
54
55 DESCRIPTION:
56
57   Fail here
58
59 EXAMPLES:
60   Fail here
61
62 "
63  "Expected blank line after: EXAMPLES:")
64
65 (deffailure-func-test
66  "Blank line - after header"
67  "UNUSED => RESULT
68  Fail here
69 "
70  "Expected blank line after: UNUSED => RESULT")
71
72 (deffailure-func-test
73  "Two spaces - beginning of types"
74  "UNUSED => RESULT
75
76   RESULT: RESULT1
77    RESULT1: NOT-HERE
78 "
79  "Type line did not match \"  TYPE: type-definition\":    RESULT1: NOT-HERE")
80
81 (deffailure-func-test
82  "Two spaces - beginning of args and values"
83  "UNUSED => RESULT
84
85 ARGUMENTS AND VALUES:
86
87    RESULT: fail here
88 "
89  "Argument line did not match \"  TYPE: desc\":    RESULT: fail here")
90
91 (deffailure-func-test
92  "Two spaces - in description"
93  "UNUSED => RESULT
94
95 ARGUMENTS AND VALUES:
96
97   RESULT: a result
98
99 DESCRIPTION:
100
101   This is a description
102
103   About some
104    things"
105  "Got unexpected line, requires blank lines or start with two spaces: \"   things\"")
106
107 (deffailure-func-test
108  "Two spaces - in examples"
109  "UNUSED => RESULT
110
111 ARGUMENTS AND VALUES:
112
113   RESULT: a result
114
115 DESCRIPTION:
116
117   This is a description
118
119 EXAMPLES:
120
121   (example1) => (yo)
122    (example2) => (yoyo)"
123  "Example line does not match \"  example => result\":    (example2) => (yoyo)")
124
125 (deffailure-func-test
126  "Two spaces - in examples"
127  "UNUSED => RESULT
128
129 ARGUMENTS AND VALUES:
130
131   RESULT: a result
132
133 DESCRIPTION:
134
135   This is a description
136
137 EXAMPLES:
138
139   (example1) => (yo)
140    (example2) => (yoyo)"
141  "Example line does not match \"  example => result\":    (example2) => (yoyo)")
142
143 (deffailure-func-test
144  "Bad type - lowercase symbol"
145  "UNUSED => REsULT
146
147   RESULT: RESULT1
148
149 "
150  "Result in UNUSED should be all upper case: REsULT")
151
152 (deffailure-func-test
153  "Bad type - or type with list"
154  "UNUSED => RESULT
155
156   RESULT: RESULT1 | (RESULT2 :success)
157
158 "
159  "Or types can't have lists in them: RESULT1 | (RESULT2 :success)")
160
161 (deffailure-func-test
162  "Bad type - or type with no space before pipe"
163  "UNUSED => RESULT
164
165   RESULT: RESULT1| RESULT2
166
167 "
168  "All or pipes must be prefaced by spaces: RESULT1| RESULT2")
169
170 (deffailure-func-test
171  "Bad type - or type with no space after pipe"
172  "UNUSED => RESULT
173
174   RESULT: RESULT1 |RESULT2
175
176 "
177  "All or pipes must be concluded by spaces: RESULT1 |RESULT2")
178
179 (deffailure-func-test
180  "Bad type - list separated by multiple spaces"
181  "UNUSED => RESULT
182
183   RESULT: (RESULT1  :success)
184
185 "
186  "Lists can be seperated by only one space: (RESULT1  :success)")
187
188 (deffailure-func-test
189  "Bad type - list parens in them"
190  "UNUSED => RESULT
191
192   RESULT: (RESULT1 (:success))
193
194 "
195  "List types can't have sublists: (RESULT1 (:success))")
196
197 (deffailure-func-test
198  "Bad type - type line doesn't have colon"
199  "UNUSED => RESULT
200
201   RESULT - RESULT1
202
203 "
204  "Type line did not match \"  TYPE: type-definition\":   RESULT - RESULT1")
205
206 (deffailure-func-test
207  "Bad type - malformed type line with colon"
208  "UNUSED => RESULT
209
210   RESULT: RESULT1 RESULT2
211
212 "
213  "Symbols had spaces in it: RESULT1 RESULT2")
214
215 (deffailure-func-test
216  "types in type section that isn't in document"
217  "UNUSED => RESULT
218
219   RESULT: RESULT1
220   RESULT2: RESULT3
221
222 "
223  "Ran out of types to talk about, but got a non empty line:   RESULT2: RESULT3")
224
225 (deffailure-func-test
226  "Description - ends with empty line when last thing"
227  "UNUSED => RESULT
228
229 ARGUMENTS AND VALUES:
230
231   RESULT: a pathname
232
233 DESCRIPTION:
234
235   Hello world
236
237 "
238  "Can't end with empty line")
239
240 (deffailure-func-test
241  "Description - malformed line"
242  "UNUSED => RESULT
243
244 ARGUMENTS AND VALUES:
245
246   RESULT: a pathname
247
248 DESCRIPTION:
249
250  A mistake"
251  "Got unexpected line, requires blank lines or start with two spaces: \" A mistake\"")
252
253 (deffailure-func-test
254  "Description - section doesn't start with description"
255  "UNUSED => RESULT
256
257 ARGUMENTS AND VALUES:
258
259   RESULT: a pathname
260
261 DESCRIPTAION:
262
263 "
264  "Expected DESCRIPTION: instead of: DESCRIPTAION:")
265
266 (deffailure-func-test
267  "Examples - doesn't have arrow"
268  "UNUSED => RESULT
269
270 ARGUMENTS AND VALUES:
271
272   RESULT: a pathname
273
274 DESCRIPTION:
275
276   This is a mock description.
277
278 EXAMPLES:
279
280   (unused) - :success
281 "
282  "Example line does not match \"  example => result\":   (unused) - :success")
283
284 (deffailure-func-test
285  "Examples - doesn't start with EXAMPLES"
286  "UNUSED => RESULT
287
288 ARGUMENTS AND VALUES:
289
290   RESULT: a pathname
291
292 DESCRIPTION:
293
294   This is a mock description.
295
296 EXAAMPLES:
297
298   (unused) => :success"
299  "Got unexpected line, requires blank lines or start with two spaces: \"EXAAMPLES:\"")
300
301 (deffailure-func-test
302  "Args-and-values - leftover unexplained args"
303  "UNUSED => RESULT
304
305   RESULT: RESULT1 | RESULT2
306
307 ARGUMENTS AND VALUES:
308
309   RESULT1: a pathname
310 "
311  "Unexplained arguments left: (RESULT2)")
312
313 (deffailure-func-test
314  "Args-and-values - doesn't match TYPE: desc"
315  "UNUSED => RESULT
316
317 ARGUMENTS AND VALUES:
318
319   RESULT - a pathname
320
321 DESCRIPTION:
322
323 "
324  "Argument line did not match \"  TYPE: desc\":   RESULT - a pathname")
325
326 (deffailure-func-test
327  "Args-and-values - section doesn't start with ARGUMENTS AND VALUES:"
328  "UNUSED => RESULT
329
330   RESULT: RESULT1
331
332 ARGUUMENTS AND VALUES:
333
334   RESULT: a pathname
335
336 DESCRIPTION:
337
338 "
339  "Expected ARGUMENTS AND VALUES: instead of: ARGUUMENTS AND VALUES:")
340
341 (deffailure-func-test
342  "Header - first line doesn't start with func-name (naturally all in upper case)"
343  "UNUUSED => RESULT
344
345 ARGUMENTS AND VALUES:
346
347   RESULT: a pathname
348
349 DESCRIPTION:
350
351 "
352  "First line of UNUSED did not match: UNUSED {ARGS}* => {RESULT}*, UNUUSED => RESULT")
353
354 (deffailure-func-test
355  "Header - arguments weren't in upper cse"
356  "UNUSED x => RESULT
357
358 ARGUMENTS AND VALUES:
359
360   RESULT: a pathname
361
362 DESCRIPTION:
363
364 "
365  "Argument in UNUSED should be all upper case: \"x\"")
366
367 (deffailure-func-test
368  "Header - results weren't in upper case"
369  "UNUSED => REsULT
370
371 ARGUMENTS AND VALUES:
372
373   RESULT: a pathname
374
375 DESCRIPTION:
376
377 "
378  "Result in UNUSED should be all upper case: REsULT")
379
380 (deffailure-var-test
381  "Blank line - after value type"
382  "*UNUSED*
383
384 VALUE TYPE:
385   generalized boolean
386
387 INITIAL VALUE:
388
389   NIL
390
391 DESCRIPTION:
392
393 "
394  "Expected blank line after: VALUE TYPE:")
395
396 (deffailure-var-test
397  "Blank line - after description"
398  "*UNUSED*
399
400 VALUE TYPE:
401
402   generalized boolean
403
404 INITIAL VALUE:
405
406   NIL
407
408 DESCRIPTION:
409   Fail here
410
411 "
412  "Expected blank line after: DESCRIPTION:")
413
414 (deffailure-var-test
415  "Blank line - after examples"
416  "*UNUSED*
417
418 VALUE TYPE:
419
420   generalized boolean
421
422 INITIAL VALUE:
423
424   NIL
425
426 DESCRIPTION:
427
428   Fail here
429
430 EXAMPLES:
431   Fail here
432
433 "
434  "Expected blank line after: EXAMPLES:")
435
436 (deffailure-var-test
437  "Blank line - after header"
438  "*UNUSED*
439  Fail here
440 "
441  "Expected blank line after: *UNUSED*")
442
443 (deffailure-var-test
444  "Two spaces - beginning of value type"
445  "*UNUSED*
446
447 VALUE TYPE:
448
449    a generalized boolean
450 "
451  "Got unexpected line, requires blank lines or start with two spaces: \"   a generalized boolean\"")
452
453 (deffailure-var-test
454  "Two spaces - beginning of initial value"
455  "*UNUSED*
456
457 VALUE TYPE:
458
459   a generalized boolean
460
461 INITIAL VALUE:
462
463    RESULT: fail here
464 "
465  "Got unexpected line, requires blank lines or start with two spaces: \"   RESULT: fail here\"")
466
467 (deffailure-var-test
468  "Two spaces - in description"
469  "*UNUSED*
470
471 VALUE TYPE:
472
473   a generalized boolean
474
475 INITIAL VALUE:
476
477   RESULT: a result
478
479 DESCRIPTION:
480
481   This is a description
482
483   About some
484    things"
485  "Got unexpected line, requires blank lines or start with two spaces: \"   things\"")
486
487 (deffailure-var-test
488  "Two spaces - in examples"
489  "*UNUSED*
490
491 VALUE TYPE:
492
493   a generalized boolean
494
495 INITIAL VALUE:
496
497   RESULT: a result
498
499 DESCRIPTION:
500
501   This is a description
502
503 EXAMPLES:
504
505   (example1) => (yo)
506    (example2) => (yoyo)"
507  "Example line does not match \"  example => result\":    (example2) => (yoyo)")
508
509 (deffailure-var-test
510  "Two spaces - in examples"
511  "*UNUSED*
512
513 VALUE TYPE:
514
515   a generalized boolean
516
517 INITIAL VALUE:
518
519   RESULT: a result
520
521 DESCRIPTION:
522
523   This is a description
524
525 EXAMPLES:
526
527   (example1) => (yo)
528    (example2) => (yoyo)"
529  "Example line does not match \"  example => result\":    (example2) => (yoyo)")
530
531 (deffailure-var-test
532  "Description - ends with empty line when last thing"
533  "*UNUSED*
534
535 VALUE TYPE:
536
537   a generalized boolean
538
539 INITIAL VALUE:
540
541   NIL
542
543 DESCRIPTION:
544
545   Hello world
546
547 "
548  "Can't end with empty line")
549
550 (deffailure-var-test
551  "Description - malformed line"
552  "*UNUSED*
553
554 VALUE TYPE:
555
556   a generalized boolean
557
558 INITIAL VALUE:
559
560   NIL
561
562 DESCRIPTION:
563
564  A mistake"
565  "Got unexpected line, requires blank lines or start with two spaces: \" A mistake\"")
566
567 (deffailure-var-test
568  "Description - section doesn't start with description"
569  "*UNUSED*
570
571 VALUE TYPE:
572
573   a generalized boolean
574
575 INITIAL VALUE:
576
577   NIL
578
579 DESCRIPTAION:
580
581 "
582  "Got unexpected line, requires blank lines or start with two spaces: \"DESCRIPTAION:\"")
583
584 (deffailure-var-test
585  "Examples - doesn't have arrow"
586  "*UNUSED*
587
588 VALUE TYPE:
589
590   a generalized boolean
591
592 INITIAL VALUE:
593
594   NIL
595
596 DESCRIPTION:
597
598   This is a mock description.
599
600 EXAMPLES:
601
602   *unused* - :success
603 "
604  "Example line does not match \"  example => result\":   *unused* - :success")
605
606 (deffailure-var-test
607  "Examples - doesn't start with EXAMPLES"
608  "*UNUSED*
609
610 VALUE TYPE:
611
612   a generalized boolean
613
614 INITIAL VALUE:
615
616   NIL
617
618 DESCRIPTION:
619
620   This is a mock description.
621
622 EXAAMPLES:
623
624   *unused* => :success"
625  "Got unexpected line, requires blank lines or start with two spaces: \"EXAAMPLES:\"")
626
627 (deffailure-var-test
628  "Header - first line doesn't start with var-name (naturally all in upper case)"
629  "*UNUUSED*
630
631 INITIAL VALUE:
632
633   RESULT: a pathname
634
635 DESCRIPTION:
636
637 "
638  "First line of *UNUSED* did not match: *UNUSED*, *UNUUSED*")
639
640 (deffailure-var-test
641  "General - No value type"
642  "*UNUSED*
643
644 INITIAL VALUE:
645
646   NIL
647
648 DESCRIPTAION:
649
650 "
651  "Expected VALUE TYPE: instead of: INITIAL VALUE:")
652
653 (deffailure-var-test
654  "General - No initial value"
655  "*UNUSED*
656
657 VALUE TYPE:
658
659   a generalized boolean
660
661 DESCRIPTION:
662
663 "
664  "Got unexpected line, requires blank lines or start with two spaces: \"DESCRIPTION:\"")
665
666 (deffailure-var-test
667  "General - Ends early"
668  "*UNUSED*
669
670 VALUE TYPE:
671
672   a generalized boolean"
673  "Got unexpected line, requires blank lines or start with two spaces: NIL")