You can run tests with named functionalities now!
catseye
10 years ago
41 | 41 |
Tests for everySecond
|
42 | 42 |
---------------------
|
43 | 43 |
|
44 | |
-> Tests for Haskell function Test.Falderal.Demo:everySecond
|
|
44 |
-> Tests for functionality "Retain every second character"
|
45 | 45 |
|
46 | 46 |
Every second symbol in the string is retained.
|
47 | 47 |
|
144 | 144 |
convertLinesToBlocks ((Pragma text):rest) fn fnMap =
|
145 | 145 |
case parsePragma text of
|
146 | 146 |
TestsFor (NamedFunctionality name) ->
|
147 | |
-- fn = look up name in fnMap
|
148 | |
convertLinesToBlocks rest fn fnMap
|
|
147 |
case lookup name fnMap of
|
|
148 |
Just fn' -> convertLinesToBlocks rest fn' fnMap
|
|
149 |
Nothing -> error ("Can't find " ++ name ++ " in " ++ (show fnMap))
|
149 | 150 |
TestsFor fn' ->
|
150 | 151 |
convertLinesToBlocks rest fn' fnMap
|
151 | 152 |
_ ->
|
|
156 | 157 |
convertLinesToBlocks (_:rest) fn fnMap =
|
157 | 158 |
convertLinesToBlocks rest fn fnMap
|
158 | 159 |
convertLinesToBlocks [] _ _ = []
|
159 | |
|
160 | 160 |
|
161 | 161 |
collectFunctionalityDefinitions ((Pragma text):rest) =
|
162 | 162 |
case parsePragma text of
|
|
204 | 204 |
|
205 | 205 |
functionalities = [
|
206 | 206 |
parseHaskellFunctionality,
|
207 | |
parseShellFunctionality
|
|
207 |
parseShellFunctionality,
|
|
208 |
parseNamedFunctionality
|
208 | 209 |
]
|
209 | 210 |
|
210 | 211 |
tryFunctionalities [] text =
|
|
234 | 235 |
Nothing ->
|
235 | 236 |
Nothing
|
236 | 237 |
|
|
238 |
parseNamedFunctionality text =
|
|
239 |
case consumeWords ["functionality"] text of
|
|
240 |
Just specifier ->
|
|
241 |
let
|
|
242 |
(name, _) = parseQuotedString specifier
|
|
243 |
in
|
|
244 |
Just $ NamedFunctionality name
|
|
245 |
Nothing ->
|
|
246 |
Nothing
|
|
247 |
|
237 | 248 |
parseSpecifier specifier =
|
238 | 249 |
let
|
239 | 250 |
(m, f) = break (\y -> y == ':') specifier
|
|
249 | 260 |
let
|
250 | 261 |
functionality = tryFunctionalities functionalities funky
|
251 | 262 |
in
|
252 | |
FunctionalityDefinition text functionality
|
|
263 |
FunctionalityDefinition name functionality
|
253 | 264 |
Nothing ->
|
254 | 265 |
error $ "bad functionality definition: " ++ text
|
255 | 266 |
|