git @ Cat's Eye Technologies Falderal / df9472b
Clean up various miscellaneous things; bump version. catseye 8 years ago
7 changed file(s) with 37 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
00 -- encoding: UTF-8
11 name: Falderal
2 version: 0.4
2 version: 0.5
33 cabal-version: >= 1.8
44 build-type: Simple
55 license: BSD3
0 The Test.Falderal source code files are made available under the
1 following BSD-style license:
0 Except where noted as being in the public domain, the Test.Falderal
1 source code files are made available under the following BSD-style
2 license:
3
24
35 Copyright (c)2011 Cat's Eye Technologies. All rights reserved.
46
7575
7676 Version 0.5 (under development):
7777
78 * The command-line format of `falderal` has changed, for the better.
79 The `test` subcommand no longer requires that the failure reporting
80 style be specified; instead, it defaults to `standard`, and can be
81 changed with a command-line option. There are also command-line
82 options for selecting the programs to run results generators, and to
83 keep generated files around instead of cleaning them up after testing.
84 * The dependency on `ghc` for running Haskell results generators has been
85 removed; these can be run by `runhaskell` now, and are run by
86 `runhaskell` by default.
7887 * Failure reporting is now consistent across languages; both Haskell and
7988 Bourne shell results generators generate an intermediate format, which
8089 `falderal` digests.
81 * Addition of the `encoding:` pragma, so that this directive can be
90 * A new pragma `encoding:` was added, so that this directive can be
8291 embedded in your Falderal document (for the benefit of your text editor)
8392 without necessarily appearing in the formatted document.
8493
101101 join _ [] = ""
102102 join _ [x] = x
103103 join glue (x:xs) = x ++ glue ++ (join glue xs)
104
105 --
106 -- Parse the first natural number out of a string. It's allowable for there
107 -- to be non-numeric digits following the last digit; they are ignored.
108 --
109
110 parseNatNumStr [] acc = acc
111 parseNatNumStr (x:xs) acc
112 | Char.isDigit x =
113 parseNatNumStr xs (acc * 10 + ((Char.ord x) - (Char.ord '0')))
114 | otherwise =
115 acc
00 module Test.Falderal.Runner (runTests) where
1
2 import Char (isDigit, ord)
31
42 import System
53 import System.IO
4341 []
4442 collectResults (kindStr:idStr:numLinesStr:rest) =
4543 let
46 id = parseNumStr idStr 0
47 numLines = parseNumStr numLinesStr 0
44 id = parseNatNumStr idStr 0
45 numLines = parseNatNumStr numLinesStr 0
4846 failLines = take numLines rest
4947 rest' = drop numLines rest
5048 resText = (join "\n" failLines)
5553 ((Result id res):collectResults rest')
5654 collectResults (idStr:rest) =
5755 let
58 id = parseNumStr idStr 0
56 id = parseNatNumStr idStr 0
5957 in
6058 ((Result id (Output "")):collectResults rest)
61
62 parseNumStr [] acc = acc
63 parseNumStr (x:xs) acc
64 | isDigit x = parseNumStr xs (acc * 10 + ((ord x) - (ord '0')))
65 | otherwise = acc
6659
6760 decorateTestsWithResults [] fails = []
6861 decorateTestsWithResults (t@(Test testId fns literalText testText expected _):tests) fails =
3535 The next _n_ lines contain the actual text generated. (If _n_ = 0, there
3636 will be no such lines.) Immediately following this group will be either
3737 another group, or the end-of-file.
38
39 The second and third lines in a group contain natural numbers; they may
40 contain arbitrary text after the final digit of the natural number, which is
41 ignored. (This is to simplify their generation from shell scripts, where
42 `wc -l` is used to produce the number of lines of output text, and where
43 `wc` also outputs the filename.)
8888 exitWith ExitSuccess
8989
9090 dispatch ("version":_) _ = do
91 putStrLn "Test.Falderal version 0.4"
91 putStrLn "Test.Falderal version 0.5"
9292
9393 dispatch _ _ = putStrLn header
9494