Add coverage, get to near 100
[sheep] / resources / success1.lisp
1 (defpackage #:success1 (:use :cl)
2  (:documentation
3 "This defines a simple successful package.
4
5 This is should all get pulled in and the markdown.md should be equal
6 to success1.md.")
7  (:export
8   #:*special-variable*
9   #:*special-variable-2*
10   #:test-condition
11   #:test-struct
12   #:func-that-does-stuff #:noargs #:no-args-and-values #:result-list #:has-no-examples
13   #:values-result #:has-optional #:has-keywords #:has-rest))
14
15 (in-package #:success1)
16
17 (defvar *special-variable* nil
18  "*SPECIAL-VARIABLE*
19
20 VALUE TYPE:
21
22   a generalized boolean
23
24 INITIAL VALUE:
25
26   NIL
27
28 DESCRIPTION:
29
30   It is special, and a boolean.
31
32   When true, it satisfies if coniditions.  When NIL, it does not.
33   That may make it seem like it's not very special, but it is.
34
35   But sometimes it needs to reference itself: *SPECIAL-VARIABLE*
36
37 EXAMPLES:
38
39   (let ((*special-variable* t)) (go)) => 'let-it-go")
40
41 (defvar *special-variable-2* nil
42  "*SPECIAL-VARIABLE-2*
43
44 VALUE TYPE:
45
46   a generalized boolean
47
48 INITIAL VALUE:
49
50   NIL
51
52 DESCRIPTION:
53
54   It is special, and a boolean.")
55
56 (define-condition test-condition nil nil
57  (:documentation
58   "Simple documentation.
59
60 For a simple condition."))
61
62 (defstruct test-struct
63  "Simple documentation.
64
65 For a simple structure.  But this structure may go to two lines
66 for this part of it.")
67
68 (defun func-that-does-stuff (path x)
69  "FUNC-THAT-DOES-STUFF PATH X => RESULT
70
71   RESULT: SUCCESS-RESULT | FAILURE-RESULT
72   SUCCESS-RESULT: (:success FILENAME)
73   FAILURE-RESULT: (:failure FILENAME MSG)
74
75 ARGUMENTS AND VALUES:
76
77   PATH: a pathname
78   X: a random value related to PATH
79   FILENAME: the file this func was run on
80   MSG: a string containing the failure message
81
82 DESCRIPTION:
83
84   FUNC-THAT-DOES-STUFF runs all the things against a file and returns
85   as soon as the first func error is found.
86
87   This second section uses PATH and X as something we should talk about, but
88   doesn't use all the arguments (let's include PATH here for fun)
89
90 EXAMPLES:
91
92   (func-that-does-stuff #P\"path/to/file.lisp\" t) => (:success \"path/to/file.lisp\")
93   (func-that-does-stuff #P\"path/to/error.lisp\" nil) => (:failure \"path/to/error.lisp\" \"Error msg\" 20 0)"
94   path)
95
96 (defun result-list ()
97  "RESULT-LIST => RESULT
98
99   RESULT: FAILURE-RESULT*
100   FAILURE-RESULT: (:failure FILENAME MSG)
101
102 ARGUMENTS AND VALUES:
103
104   FILENAME: the file this func was run on
105   MSG: a string containing the failure message
106
107 DESCRIPTION:
108
109   RESULT-LIST runs all the things against a file and returns
110   as soon as the first func error is found."
111   nil)
112
113 (defun noargs ()
114  "NOARGS => RESULT
115
116   RESULT: SUCCESS-RESULT | FAILURE-RESULT
117   SUCCESS-RESULT: (:success FILENAME)
118   FAILURE-RESULT: (:failure FILENAME MSG)
119
120 ARGUMENTS AND VALUES:
121
122   FILENAME: the file this func was run on
123   MSG: a string containing the failure message
124
125 DESCRIPTION:
126
127   NOARGS runs all the things against a file and returns
128   as soon as the first func error is found.
129
130 EXAMPLES:
131
132   (func-that-does-stuff) => (:success \"path/to/file.lisp\")
133   (func-that-does-stuff) => (:failure \"path/to/error.lisp\" \"Error msg\" 20 0)"
134   nil)
135
136 (defun no-args-and-values ()
137  "NO-ARGS-AND-VALUES => RESULT
138
139   RESULT: :nothing
140
141 DESCRIPTION:
142
143   RESULT-LIST runs all the things against a file and returns
144   as soon as the first func error is found."
145   nil)
146
147 (defun has-no-examples ()
148  "HAS-NO-EXAMPLES => RESULT
149
150   RESULT: SUCCESS-RESULT | FAILURE-RESULT
151   SUCCESS-RESULT: (:success FILENAME)
152   FAILURE-RESULT: (:failure FILENAME MSG)
153
154 ARGUMENTS AND VALUES:
155
156   FILENAME: the file this func was run on
157   MSG: a string containing the failure message
158
159 DESCRIPTION:
160
161   HAS-NO-EXAMPLES runs all the things against a file and returns
162   as soon as the first func error is found."
163   nil)
164
165 (defun values-result ()
166  "VALUES-RESULT => RESULT1, RESULT2, RESULT3
167
168   RESULT1: SUCCESS-RESULT | FAILURE-RESULT
169   SUCCESS-RESULT: (:success FILENAME)
170   FAILURE-RESULT: (:failure FILENAME MSG)
171
172 ARGUMENTS AND VALUES:
173
174   RESULT2: second result
175   RESULT3: third result
176   FILENAME: the file this func was run on
177   MSG: a string containing the failure message
178
179 DESCRIPTION:
180
181   VALUES-RESULT runs all the things against a file and returns
182   as soon as the first func error is found."
183   nil)
184
185 (defun has-optional (path &optional x)
186  "HAS-OPTIONAL PATH &optional X => RESULT
187
188   RESULT: SUCCESS-RESULT | FAILURE-RESULT
189   SUCCESS-RESULT: (:success FILENAME)
190   FAILURE-RESULT: (:failure FILENAME MSG)
191
192 ARGUMENTS AND VALUES:
193
194   PATH: a pathname
195   X: a random value related to PATH
196   FILENAME: the file this func was run on
197   MSG: a string containing the failure message
198
199 DESCRIPTION:
200
201   HAS-OPTIONAL runs all the things against a file and returns
202   as soon as the first func error is found.
203
204   This second section uses PATH and X as something we should talk about, but
205   doesn't use all the arguments (let's include PATH here for fun)"
206   path)
207
208 (defun has-keywords (path &key x)
209  "HAS-KEYWORDS PATH &key X => RESULT
210
211   RESULT: SUCCESS-RESULT | FAILURE-RESULT
212   SUCCESS-RESULT: (:success FILENAME)
213   FAILURE-RESULT: (:failure FILENAME MSG)
214
215 ARGUMENTS AND VALUES:
216
217   PATH: a pathname
218   X: a random value related to PATH
219   FILENAME: the file this func was run on
220   MSG: a string containing the failure message
221
222 DESCRIPTION:
223
224   HAS-KEYWORDS runs all the things against a file and returns
225   as soon as the first func error is found.
226
227   This second section uses PATH and X as something we should talk about, but
228   doesn't use all the arguments (let's include PATH here for fun)"
229   path)
230
231 (defun has-rest (path &rest x)
232  "HAS-REST PATH &rest X => RESULT
233
234   RESULT: SUCCESS-RESULT | FAILURE-RESULT
235   SUCCESS-RESULT: (:success FILENAME)
236   FAILURE-RESULT: (:failure FILENAME MSG)
237
238 ARGUMENTS AND VALUES:
239
240   PATH: a pathname
241   X: a random value related to PATH
242   FILENAME: the file this func was run on
243   MSG: a string containing the failure message
244
245 DESCRIPTION:
246
247   HAS-REST runs all the things against a file and returns
248   as soon as the first func error is found.
249
250   This second section uses PATH and X as something we should talk about, but
251   doesn't use all the arguments (let's include PATH here for fun)"
252   path)