1 ; Copyright 2022 Frank Duncan (frank@consxy.com) under AGPL3. See distributed LICENSE.txt.
2 (in-package #:sheep-test)
5 ((long-line (format nil "~A~A"
6 "This second section uses PATH and X as something we should talk about, "
7 "but doesn't use all the arguments (let's include PATH here for fun)")))
10 (format nil "UNUSED => RESULT
20 (format nil "Longer than 120 chars: ~A" long-line)))
23 "Blank line - after args and vals"
32 "Expected blank line after: ARGUMENTS AND VALUES:")
35 "Blank line - after description"
46 "Expected blank line after: DESCRIPTION:")
49 "Blank line - after examples"
64 "Expected blank line after: EXAMPLES:")
67 "Blank line - after header"
71 "Expected blank line after: UNUSED => RESULT")
74 "Two spaces - beginning of types"
80 "Type line did not match \" TYPE: type-definition\": RESULT1: NOT-HERE")
83 "Two spaces - beginning of args and values"
90 "Argument line did not match \" TYPE: desc\": RESULT: fail here")
93 "Two spaces - in description"
102 This is a description
106 "Got unexpected line, requires blank lines or start with two spaces: \" things\"")
108 (deffailure-func-test
109 "Two spaces - in examples"
112 ARGUMENTS AND VALUES:
118 This is a description
123 (example2) => (yoyo)"
124 "Example line does not match \" example => result\": (example2) => (yoyo)")
126 (deffailure-func-test
127 "Two spaces - in examples"
130 ARGUMENTS AND VALUES:
136 This is a description
141 (example2) => (yoyo)"
142 "Example line does not match \" example => result\": (example2) => (yoyo)")
144 (deffailure-func-test
145 "Bad type - lowercase symbol"
151 "Result in UNUSED should be all upper case: REsULT")
153 (deffailure-func-test
154 "Bad type - or type with list"
157 RESULT: RESULT1 | (RESULT2 :success)
160 "Or types can't have lists in them: RESULT1 | (RESULT2 :success)")
162 (deffailure-func-test
163 "Bad type - or type with no space before pipe"
166 RESULT: RESULT1| RESULT2
169 "All or pipes must be prefaced by spaces: RESULT1| RESULT2")
171 (deffailure-func-test
172 "Bad type - or type with no space after pipe"
175 RESULT: RESULT1 |RESULT2
178 "All or pipes must be concluded by spaces: RESULT1 |RESULT2")
180 (deffailure-func-test
181 "Bad type - list separated by multiple spaces"
184 RESULT: (RESULT1 :success)
187 "Lists can be seperated by only one space: (RESULT1 :success)")
189 (deffailure-func-test
190 "Bad type - list parens in them"
193 RESULT: (RESULT1 (:success))
196 "List types can't have sublists: (RESULT1 (:success))")
198 (deffailure-func-test
199 "Bad type - type line doesn't have colon"
205 "Type line did not match \" TYPE: type-definition\": RESULT - RESULT1")
207 (deffailure-func-test
208 "Bad type - malformed type line with colon"
211 RESULT: RESULT1 RESULT2
214 "Symbols had spaces in it: RESULT1 RESULT2")
216 (deffailure-func-test
217 "types in type section that isn't in document"
224 "Ran out of types to talk about, but got a non empty line: RESULT2: RESULT3")
226 (deffailure-func-test
227 "Description - ends with empty line when last thing"
230 ARGUMENTS AND VALUES:
239 "Can't end with empty line")
241 (deffailure-func-test
242 "Description - malformed line"
245 ARGUMENTS AND VALUES:
252 "Got unexpected line, requires blank lines or start with two spaces: \" A mistake\"")
254 (deffailure-func-test
255 "Description - section doesn't start with description"
258 ARGUMENTS AND VALUES:
265 "Expected DESCRIPTION: instead of: DESCRIPTAION:")
267 (deffailure-func-test
268 "Examples - doesn't have arrow"
271 ARGUMENTS AND VALUES:
277 This is a mock description.
283 "Example line does not match \" example => result\": (unused) - :success")
285 (deffailure-func-test
286 "Examples - doesn't start with EXAMPLES"
289 ARGUMENTS AND VALUES:
295 This is a mock description.
299 (unused) => :success"
300 "Got unexpected line, requires blank lines or start with two spaces: \"EXAAMPLES:\"")
302 (deffailure-func-test
303 "Args-and-values - leftover unexplained args"
306 RESULT: RESULT1 | RESULT2
308 ARGUMENTS AND VALUES:
312 "Unexplained arguments left: (RESULT2)")
314 (deffailure-func-test
315 "Args-and-values - doesn't match TYPE: desc"
318 ARGUMENTS AND VALUES:
325 "Argument line did not match \" TYPE: desc\": RESULT - a pathname")
327 (deffailure-func-test
328 "Args-and-values - section doesn't start with ARGUMENTS AND VALUES:"
333 ARGUUMENTS AND VALUES:
340 "Expected ARGUMENTS AND VALUES: instead of: ARGUUMENTS AND VALUES:")
342 (deffailure-func-test
343 "Args-and-values - non empty next line"
346 ARGUMENTS AND VALUES:
354 "No arguments left, but next line isn't empty: RESULT2: a thing")
356 (deffailure-func-test
357 "Args-and-values - out of order arguments"
358 "UNUSED => RESULT1, RESULT2
360 ARGUMENTS AND VALUES:
368 "Expected a description for RESULT1 but got one for RESULT2")
370 (deffailure-func-test
371 "Args-and-values - ended before all arguments"
372 "UNUSED => RESULT1, RESULT2
374 ARGUMENTS AND VALUES:
377 "Expected line after: RESULT1: a thing")
379 (deffailure-func-test
380 "Header - first line doesn't start with func-name (naturally all in upper case)"
383 ARGUMENTS AND VALUES:
390 "First line of UNUSED did not match: UNUSED {ARGS}* => {RESULT}*, UNUUSED => RESULT")
392 (deffailure-func-test
393 "Header - arguments weren't in upper cse"
396 ARGUMENTS AND VALUES:
403 "Argument in UNUSED should be all upper case: \"x\"")
405 (deffailure-func-test
406 "Header - results weren't in upper case"
409 ARGUMENTS AND VALUES:
416 "Result in UNUSED should be all upper case: REsULT")
418 (deffailure-func-test
419 "Description - can't end line with space"
422 ARGUMENTS AND VALUES:
430 "Can't end line with a space: This is a test ")
432 (deffailure-func-test
433 "Symbols - keyword symbols must be all in lower case"
442 "Keyword symbols must all be lower case: :ASDF")
444 (deffailure-func-test
445 "Symbols - type symbols must be all in lower case"
454 "Type symbols must all be upper case: asdf")
456 (deffailure-func-test
457 "Symbols - list types can't have | in them"
460 RESULT: (ASDF | FDSA)
466 "List types can't have | in them: (ASDF | FDSA)")
469 "Blank line - after value type"
482 "Expected blank line after: VALUE TYPE:")
485 "Blank line - after description"
500 "Expected blank line after: DESCRIPTION:")
503 "Blank line - after examples"
522 "Expected blank line after: EXAMPLES:")
525 "Blank line - after header"
529 "Expected blank line after: *UNUSED*")
532 "Two spaces - beginning of value type"
537 a generalized boolean
539 "Got unexpected line, requires blank lines or start with two spaces: \" a generalized boolean\"")
542 "Two spaces - beginning of initial value"
547 a generalized boolean
553 "Got unexpected line, requires blank lines or start with two spaces: \" RESULT: fail here\"")
556 "Two spaces - in description"
561 a generalized boolean
569 This is a description
573 "Got unexpected line, requires blank lines or start with two spaces: \" things\"")
576 "Two spaces - in examples"
581 a generalized boolean
589 This is a description
594 (example2) => (yoyo)"
595 "Example line does not match \" example => result\": (example2) => (yoyo)")
598 "Two spaces - in examples"
603 a generalized boolean
611 This is a description
616 (example2) => (yoyo)"
617 "Example line does not match \" example => result\": (example2) => (yoyo)")
620 "Description - ends with empty line when last thing"
625 a generalized boolean
636 "Can't end with empty line")
639 "Description - malformed line"
644 a generalized boolean
653 "Got unexpected line, requires blank lines or start with two spaces: \" A mistake\"")
656 "Description - section doesn't start with description"
661 a generalized boolean
670 "Got unexpected line, requires blank lines or start with two spaces: \"DESCRIPTAION:\"")
673 "Examples - doesn't have arrow"
678 a generalized boolean
686 This is a mock description.
692 "Example line does not match \" example => result\": *unused* - :success")
695 "Examples - doesn't start with EXAMPLES"
700 a generalized boolean
708 This is a mock description.
712 *unused* => :success"
713 "Got unexpected line, requires blank lines or start with two spaces: \"EXAAMPLES:\"")
716 "Header - first line doesn't start with var-name (naturally all in upper case)"
726 "First line of *UNUSED* did not match: *UNUSED*, *UNUUSED*")
729 "General - No value type"
739 "Expected VALUE TYPE: instead of: INITIAL VALUE:")
742 "General - No initial value"
747 a generalized boolean
752 "Got unexpected line, requires blank lines or start with two spaces: \"DESCRIPTION:\"")
755 "General - Ends early"
760 a generalized boolean"
761 "Got unexpected line, requires blank lines or start with two spaces: NIL")
764 "General - Can't end line with a space"
769 a generalized boolean
777 This description line ends with a space "
778 "Can't end line with a space: This description line ends with a space ")
781 "General - Longer than 120 characters"
787 a generalized boolean
795 This description line ends with a space is very very long, so very long, really really long"
796 "it just keeps going and going and going and going and going and going")
797 (format nil "Longer than 120 chars: ~A~A"
798 "This description line ends with a space is very very long, so very long, really really long"
799 "it just keeps going and going and going and going and going and going"))
803 "Unused package with a first line that is extremely long, and how could it be so
804 long and it keeps going and going and going and going and going and going"
805 "First package paragraph is longer than 120 characters")
810 "Unused package with a first line that is extremely long, and how could it be so"
811 "long and it keeps going and going and going and going and going and going")
813 "Package description longer than 120 characters: "
814 "Unused package with a first line that is extremely long, and how could it be so"
815 "long and it keeps going and going and going and going and going and going"))
823 "Package description has two empty lines in it")
828 "Package description line started with space: Basic Description")
833 "Package description line ended with space: Basic Description ")
835 (deffailure-struc-test
841 "Structure description has two empty lines in it")
843 (deffailure-struc-test
846 "Unused package with a first line that is extremely long, and how could it be so"
847 "long and it keeps going and going and going and going and going and going")
849 "Structure description longer than 120 characters: "
850 "Unused package with a first line that is extremely long, and how could it be so"
851 "long and it keeps going and going and going and going and going and going"))
853 (deffailure-struc-test
856 "Structure description line started with space: Basic Description")
858 (deffailure-struc-test
861 "Structure description line ended with space: Basic Description ")