[darcs-users] darcs patch: Add tests for email header formatting (and 2 more)
Trent W. Buck
trentbuck at gmail.com
Mon Mar 16 01:01:47 UTC 2009
Reinier Lamers <tux_rocker at reinier.de> writes:
> +\chapter{Email format tests}
> +
> +These tests check whether the emails generated by darcs meet a few criteria.
> +We check for line length and non-ASCII characters. We apparently do not have to
> +check for CR-LF newlines because that's handled by sendmail.
Any reason the above can't be a haddock module comment (a "-- | text"
before the "module foo" line).
> +-- Check that formatHeader never creates lines longer than 78 characters
> +-- (excluding the carriage return and line feed)
> +email_header_no_long_lines :: String -> String -> Bool
Similarly, please use -- | here, so haddock knows the comment describes
the function. Ideally you should also check there are no parsing errors
by installing a recent haddock in your $PATH, and doing "cabal haddock".
> +# TODO: is this really enough to make all commands interpret the given strings
> +# as latin1?
> +export LANG="en_US.ISO-8859-1"
It is not safe to assume that this locale exists. Also, when overriding
you should use LC_ALL, not LANG.
To get ASCII, you can pretty reliably export LC_ALL=C.
Worst case: use "locale -a" to check if a latin-1 locale is available,
then use it. If none are available, skip/fail the test.
> +echo "Have you seen the sm\370rrebr\370d of Ren\351 \307av\351sant?" > non_ascii_file
I don't like having non-ASCII bytes in a file -- in particular in a
legacy (not Unicode) encoding. Can't you use printf %b or similar?
In fact, is there any need for non-ASCII in this test at all? It seems
to be concerned with string lengths, not encodings.
More information about the darcs-users
mailing list