src/testing.c
static void
fill_assert_error(
    garray_T	*gap,
    typval_T	*opt_msg_tv,
    char_u      *exp_str,
    typval_T	*exp_tv,
    typval_T	*got_tv,
    assert_type_T atype)
{
    char_u	numbuf[NUMBUFLEN];
    char_u	*tofree;

    if (opt_msg_tv->v_type != VAR_UNKNOWN)
    {
	ga_concat(gap, echo_string(opt_msg_tv, &tofree, numbuf, 0));
	vim_free(tofree);
	ga_concat(gap, (char_u *)": ");
    }

    if (atype == ASSERT_MATCH || atype == ASSERT_NOTMATCH)
	ga_concat(gap, (char_u *)"Pattern ");
    else if (atype == ASSERT_NOTEQUAL)
	ga_concat(gap, (char_u *)"Expected not equal to ");
    else
	ga_concat(gap, (char_u *)"Expected ");
    if (exp_str == NULL)
    {
	ga_concat_shorten_esc(gap, tv2string(exp_tv, &tofree, numbuf, 0));
	vim_free(tofree);
    }
    else
	ga_concat_shorten_esc(gap, exp_str);
    if (atype != ASSERT_NOTEQUAL)
    {
	if (atype == ASSERT_MATCH)
	    ga_concat(gap, (char_u *)" does not match ");
	else if (atype == ASSERT_NOTMATCH)
	    ga_concat(gap, (char_u *)" does match ");
	else
	    ga_concat(gap, (char_u *)" but got ");
	ga_concat_shorten_esc(gap, tv2string(got_tv, &tofree, numbuf, 0));
	vim_free(tofree);
    }
}
/*
 * Fill "gap" with information about an assert error.
 */
Fill "gap" with information about an assert error.
Fill " gap " with information about an assert error .
static void
fill_assert_error(
    garray_T	*gap,
    typval_T	*opt_msg_tv,
    char_u      *exp_str,
    typval_T	*exp_tv,
    typval_T	*got_tv,
    assert_type_T atype)
{
    char_u	numbuf[NUMBUFLEN];
    char_u	*tofree;
    if (opt_msg_tv->v_type != VAR_UNKNOWN)
    {
	ga_concat(gap, echo_string(opt_msg_tv, &tofree, numbuf, 0));
	vim_free(tofree);
	ga_concat(gap, (char_u *)": ");
    }
    if (atype == ASSERT_MATCH || atype == ASSERT_NOTMATCH)
	ga_concat(gap, (char_u *)"Pattern ");
    else if (atype == ASSERT_NOTEQUAL)
	ga_concat(gap, (char_u *)"Expected not equal to ");
    else
	ga_concat(gap, (char_u *)"Expected ");
    if (exp_str == NULL)
    {
	ga_concat_shorten_esc(gap, tv2string(exp_tv, &tofree, numbuf, 0));
	vim_free(tofree);
    }
    else
	ga_concat_shorten_esc(gap, exp_str);
    if (atype != ASSERT_NOTEQUAL)
    {
	if (atype == ASSERT_MATCH)
	    ga_concat(gap, (char_u *)" does not match ");
	else if (atype == ASSERT_NOTMATCH)
	    ga_concat(gap, (char_u *)" does match ");
	else
	    ga_concat(gap, (char_u *)" but got ");
	ga_concat_shorten_esc(gap, tv2string(got_tv, &tofree, numbuf, 0));
	vim_free(tofree);
    }
}
static void fill_assert_error ( garray_T * gap , typval_T * opt_msg_tv , char_u * exp_str , typval_T * exp_tv , typval_T * got_tv , assert_type_T atype ) { char_u numbuf [ NUMBUFLEN ] ; char_u * tofree ; if ( opt_msg_tv -> v_type != VAR_UNKNOWN ) { ga_concat ( gap , echo_string ( opt_msg_tv , & tofree , numbuf , 0 ) ) ; vim_free ( tofree ) ; ga_concat ( gap , ( char_u * ) " " ) ; } if ( atype == ASSERT_MATCH || atype == ASSERT_NOTMATCH ) ga_concat ( gap , ( char_u * ) " " ) ; else if ( atype == ASSERT_NOTEQUAL ) ga_concat ( gap , ( char_u * ) " " ) ; else ga_concat ( gap , ( char_u * ) " " ) ; if ( exp_str == NULL ) { ga_concat_shorten_esc ( gap , tv2string ( exp_tv , & tofree , numbuf , 0 ) ) ; vim_free ( tofree ) ; } else ga_concat_shorten_esc ( gap , exp_str ) ; if ( atype != ASSERT_NOTEQUAL ) { if ( atype == ASSERT_MATCH ) ga_concat ( gap , ( char_u * ) " " ) ; else if ( atype == ASSERT_NOTMATCH ) ga_concat ( gap , ( char_u * ) " " ) ; else ga_concat ( gap , ( char_u * ) " " ) ; ga_concat_shorten_esc ( gap , tv2string ( got_tv , & tofree , numbuf , 0 ) ) ; vim_free ( tofree ) ; } }
Fill "gap" with information about an assert error.
Fill " gap " with information about an assert error .