git @ Cat's Eye Technologies Falderal / 272a966
Directly specifying the functionality in a "Tests for" is no more. Chris Pressey 9 years ago
1 changed file(s) with 0 addition(s) and 24 deletion(s). Raw diff Collapse all Expand all
218218
219219 -> Tests for 'Reversing a string'
220220
221 Alternatively, the following direct way of associating tests with an
222 implementation of a functionality, may be used. However, this direct way
223 of specifying a functionality is discouraged when there may be conceivably
224 be multiple implementation of the functionality.
225
226 -> Tests for _functionality-type_ _functionality-specifier_
227
228 _functionality-type_ and _functionality-specifier_ have the same meaning
229 as given in the description of the Functionality-definition pragma.
230
231 For example:
232
233 -> Tests for Haskell function Data.Backwards:reverseString
234
235221 Test Body, Test Input and Expected Text
236222 ---------------------------------------
237223
322308 The format of pragmas was chosen such that they could be read literately,
323309 and as such, a formatting tool could format them in the output document
324310 with little if any change.
325
326 Here is why directly specifying the functionality implementation in a
327 Tests-for pragma is discouraged. Saying `-> Tests for shell command
328 "flang %(test-body-text)"` ties a set of tests to a particular executable,
329 that is to say a particular *implementation* of a language, which is being
330 tested, but a large part of the point of Falderal is to let you write
331 tests for a *language*, and that language might have *many* implementations.
332 Decoupling them allows you to change what actual functions or programs
333 are being tested, and basically allow you to have multiple implementations
334 of a language and use the same tests for all of them.