Difference between revisions of "Library tests"

From HaskellWiki
Jump to navigation Jump to search
(Some goals and existing work)
 
(In the middle of changing.)
Line 13: Line 13:
   
 
== Design ==
 
== Design ==
  +
TBD
 
  +
Need to recognise parameters. GenTests.hs currently recognises a small range of special variables. What about declaring the parameter names and associated types in a header comment? For instance
  +
  +
-- > :type xs, ys :: [Int]
  +
  +
this would declare that xs and ys are free variables in any following tests and of the type specified. They can then be recognised at the lexical level.
  +
  +
Alternatively, what about special "forall" syntax such as:
  +
  +
forall (xs, ys :: [Int]) . reverse xs ++ reverse ys == reverse (ys ++ xs)
  +
  +
GenTests currently has flag syntax for Posix and Windows tests (necessary for FilePath). Should this be in a general solution? If so, are other flags required?
  +
  +
Do we need special syntax for

Revision as of 22:12, 19 March 2007

Goals

  1. Help library developers ensure that their changes work.
  2. Enable something like BuildBot to ensure that libraries keep working across all the Implementations.
  3. Enable test-driven development if a developer wants to use it.
  4. Provide a series of testcases for implementation developers.

Status

According to Ian Lynagh, SimonM has been moving tests a directory at a time from the testsuite package that comes with ghc to libraries/foo/tests. It looks like he's gotten to unix and network. The tests "assume the package is part of a GHC build tree with the testsuite installed in ../../../testsuite."

Neil Mitchell has a program at http://www.cs.york.ac.uk/fp/darcs/filepath/GenTests.hs to automatically extract tests from Haddock comments like the ones in http://www.cs.york.ac.uk/fp/darcs/filepath/System/FilePath/Version_0_11.hs.

Design

Need to recognise parameters. GenTests.hs currently recognises a small range of special variables. What about declaring the parameter names and associated types in a header comment? For instance

-- > :type xs, ys :: [Int]

this would declare that xs and ys are free variables in any following tests and of the type specified. They can then be recognised at the lexical level.

Alternatively, what about special "forall" syntax such as:

forall (xs, ys :: [Int]) . reverse xs ++ reverse ys == reverse (ys ++ xs)

GenTests currently has flag syntax for Posix and Windows tests (necessary for FilePath). Should this be in a general solution? If so, are other flags required?

Do we need special syntax for