diff options
author | Ian Lynagh <ian@well-typed.com> | 2013-02-14 14:48:09 +0000 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2013-02-14 15:41:43 +0000 |
commit | aea57e43c46923be8195896df22bcc2b60ebd8d1 (patch) | |
tree | 82aaf71755608e8959fcf37f26c3caa84330e5d2 /testsuite/driver | |
parent | be6d11c3543851fa067eaae0ccb4e17dd97f2b78 (diff) | |
download | haskell-aea57e43c46923be8195896df22bcc2b60ebd8d1.tar.gz |
Remove uses of compose(s) in tests, and change how composition is handled
The driver now also supports nested lists of setup functions
Diffstat (limited to 'testsuite/driver')
-rw-r--r-- | testsuite/driver/testlib.py | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index de8ab90122..355392656a 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -62,7 +62,7 @@ def setLocalTestOpts(opts): # for the following tests. def setTestOpts( f ): global thisdir_settings - thisdir_settings = compose(thisdir_settings, f) + thisdir_settings = [thisdir_settings, f] # ----------------------------------------------------------------------------- # Canned setup functions for common cases. eg. for a test you might say @@ -475,15 +475,16 @@ def two_normalisers(f, g): # ---- # Function for composing two opt-fns together -def composes( fs ): - return reduce(lambda f, g: compose(f, g), fs) +def executeSetups(fs, name, opts): + if type(fs) is types.ListType: + # If we have a list of setups, then execute each one + map (lambda f : executeSetups(f, name, opts), fs) + else: + # fs is a single function, so just apply it + fs(name, opts) def compose( f, g ): - return lambda name, opts, f=f, g=g: _compose(name, opts, f, g) - -def _compose( name, opts, f, g ): - f(name, opts) - g(name, opts) + return [f, g] # ----------------------------------------------------------------------------- # The current directory of tests @@ -539,11 +540,7 @@ def test (name, setup, func, args): # them, all tests will see the modified version! myTestOpts = copy.deepcopy(default_testopts) - if type(setup) is types.ListType: - setup = composes(setup) - - setup = compose(thisdir_settings, setup) - setup(name, myTestOpts) + executeSetups([thisdir_settings, setup], name, myTestOpts) thisTest = lambda : runTest(myTestOpts, name, func, args) if myTestOpts.alone: |