@@ -74,17 +74,22 @@ impl TestDesc {
7474 }
7575}
7676
77+ /// Represents a benchmark function.
78+ pub trait TDynBenchFn {
79+ fn run ( & self , harness : & mut BenchHarness ) ;
80+ }
81+
7782// A function that runs a test. If the function returns successfully,
7883// the test succeeds; if the function fails then the test fails. We
7984// may need to come up with a more clever definition of test in order
8085// to support isolation of tests into tasks.
8186pub enum TestFn {
8287 StaticTestFn ( extern fn ( ) ) ,
8388 StaticBenchFn ( extern fn ( & mut BenchHarness ) ) ,
84- StaticMetricFn ( ~ fn ( & mut MetricMap ) ) ,
85- DynTestFn ( ~ fn ( ) ) ,
86- DynMetricFn ( ~ fn ( & mut MetricMap ) ) ,
87- DynBenchFn ( ~fn ( & mut BenchHarness ) )
89+ StaticMetricFn ( proc ( & mut MetricMap ) ) ,
90+ DynTestFn ( proc ( ) ) ,
91+ DynMetricFn ( proc ( & mut MetricMap ) ) ,
92+ DynBenchFn ( ~TDynBenchFn )
8893}
8994
9095impl TestFn {
@@ -859,7 +864,7 @@ pub fn run_test(force_ignore: bool,
859864
860865 fn run_test_inner( desc: TestDesc ,
861866 monitor_ch: SharedChan <MonitorMsg >,
862- testfn: ~ fn ( ) ) {
867+ testfn: proc ( ) ) {
863868 let testfn_cell = :: std:: cell:: Cell :: new( testfn) ;
864869 do task:: spawn {
865870 let mut task = task:: task( ) ;
@@ -878,8 +883,8 @@ pub fn run_test(force_ignore: bool,
878883 }
879884
880885 match testfn {
881- DynBenchFn ( benchfn ) => {
882- let bs = :: test:: bench:: benchmark( benchfn ) ;
886+ DynBenchFn ( bencher ) => {
887+ let bs = :: test:: bench:: benchmark( |harness| bencher . run ( harness ) ) ;
883888 monitor_ch. send( ( desc, TrBench ( bs) ) ) ;
884889 return ;
885890 }
0 commit comments