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 "Header - first line doesn't start with func-name (naturally all in upper case)"
346 ARGUMENTS AND VALUES:
353 "First line of UNUSED did not match: UNUSED {ARGS}* => {RESULT}*, UNUUSED => RESULT")
355 (deffailure-func-test
356 "Header - arguments weren't in upper cse"
359 ARGUMENTS AND VALUES:
366 "Argument in UNUSED should be all upper case: \"x\"")
368 (deffailure-func-test
369 "Header - results weren't in upper case"
372 ARGUMENTS AND VALUES:
379 "Result in UNUSED should be all upper case: REsULT")
382 "Blank line - after value type"
395 "Expected blank line after: VALUE TYPE:")
398 "Blank line - after description"
413 "Expected blank line after: DESCRIPTION:")
416 "Blank line - after examples"
435 "Expected blank line after: EXAMPLES:")
438 "Blank line - after header"
442 "Expected blank line after: *UNUSED*")
445 "Two spaces - beginning of value type"
450 a generalized boolean
452 "Got unexpected line, requires blank lines or start with two spaces: \" a generalized boolean\"")
455 "Two spaces - beginning of initial value"
460 a generalized boolean
466 "Got unexpected line, requires blank lines or start with two spaces: \" RESULT: fail here\"")
469 "Two spaces - in description"
474 a generalized boolean
482 This is a description
486 "Got unexpected line, requires blank lines or start with two spaces: \" things\"")
489 "Two spaces - in examples"
494 a generalized boolean
502 This is a description
507 (example2) => (yoyo)"
508 "Example line does not match \" example => result\": (example2) => (yoyo)")
511 "Two spaces - in examples"
516 a generalized boolean
524 This is a description
529 (example2) => (yoyo)"
530 "Example line does not match \" example => result\": (example2) => (yoyo)")
533 "Description - ends with empty line when last thing"
538 a generalized boolean
549 "Can't end with empty line")
552 "Description - malformed line"
557 a generalized boolean
566 "Got unexpected line, requires blank lines or start with two spaces: \" A mistake\"")
569 "Description - section doesn't start with description"
574 a generalized boolean
583 "Got unexpected line, requires blank lines or start with two spaces: \"DESCRIPTAION:\"")
586 "Examples - doesn't have arrow"
591 a generalized boolean
599 This is a mock description.
605 "Example line does not match \" example => result\": *unused* - :success")
608 "Examples - doesn't start with EXAMPLES"
613 a generalized boolean
621 This is a mock description.
625 *unused* => :success"
626 "Got unexpected line, requires blank lines or start with two spaces: \"EXAAMPLES:\"")
629 "Header - first line doesn't start with var-name (naturally all in upper case)"
639 "First line of *UNUSED* did not match: *UNUSED*, *UNUUSED*")
642 "General - No value type"
652 "Expected VALUE TYPE: instead of: INITIAL VALUE:")
655 "General - No initial value"
660 a generalized boolean
665 "Got unexpected line, requires blank lines or start with two spaces: \"DESCRIPTION:\"")
668 "General - Ends early"
673 a generalized boolean"
674 "Got unexpected line, requires blank lines or start with two spaces: NIL")