Roxen.git / server / etc / test / tests / pike_test_common.pike

version» Context lines:

Roxen.git/server/etc/test/tests/pike_test_common.pike:176:    };       // Write out the test after running it, since the macros change    // test_text_args in the test.    report_1st( test_text, test_text_args, check_return );       if( err && throw_error ) {    report_test_failure( err, test_text, test_text_args, st );    throw( err );    } -  if( check_return ) +  if( check_return && throw_error ) +  check_return( result, err, test_text, test_text_args, st, throw_error ); +  else if( check_return )    check_return( result, err, test_text, test_text_args,st );    else if( err )    report_test_failure( err, test_text, test_text_args,st );    else    report_test_ok( err, test_text, test_text_args,st );    return result;   }         void check_error( mixed res, mixed err,
Roxen.git/server/etc/test/tests/pike_test_common.pike:233:    if( err )    report_test_failure( err, cb, args, st );    else    if( !objectp(res) || !res->is_configuration )    report_test_failure( sprintf("Got %O, expected configuration", res),cb,args, st);    else    report_test_ok( err, cb, args, st );   }      void silent_check_true( mixed res, mixed err, -  function|string|array cb, array args, int st ) +  function|string|array cb, array args, int st, +  bool|void throw_error )   { -  if (err || !res) +  if( err || !res ) {    report_test_failure( err, cb, args, st ); -  else +  if( throw_error ) { +  if( err ) { +  throw( err ); +  } else { +  error( "Condition failed" ); +  } +  } +  } else {    report_test_ok( 0, cb, args, st );    } -  + }      void check_true( mixed res, mixed err,    function|string|array cb, array args, int st,    bool|void throw_error )   {    if( err ) {    report_test_failure( err, cb, args, st );    if( throw_error ) {    throw( err );    }    } -  else -  if( !res ) { +  else if( !res ) {    report_test_failure( sprintf ("expected non-zero, got %O", res),    cb, args, st);    if( throw_error ) {    error( sprintf ("expected non-zero, got %O", res) );    } -  } -  else +  } else {    report_test_ok( err, cb, args, st );    } -  + }      private void assert_result_true( mixed res, mixed err,    function|string|array cb, array args, int st )   {    check_true(res, err, cb, args, st, true);   }         void check_false( mixed res, mixed err,    function|string|array cb, array args, int st,