vbscript: Added MonthName implementation.

This commit is contained in:
Jacek Caban 2012-09-27 13:11:08 +02:00 committed by Alexandre Julliard
parent a42f3cb45e
commit 564d551a89
2 changed files with 30 additions and 2 deletions

View File

@ -1271,8 +1271,29 @@ static HRESULT Global_WeekdayName(vbdisp_t *This, VARIANT *arg, unsigned args_cn
static HRESULT Global_MonthName(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{
FIXME("\n");
return E_NOTIMPL;
int month, abbrev = 0;
BSTR ret;
HRESULT hres;
TRACE("\n");
assert(args_cnt == 1 || args_cnt == 2);
hres = to_int(arg+args_cnt-1, &month);
if(FAILED(hres))
return hres;
if(args_cnt == 2) {
hres = to_int(arg, &abbrev);
if(FAILED(hres))
return hres;
}
hres = VarMonthName(month, abbrev, 0, &ret);
if(FAILED(hres))
return hres;
return return_bstr(res, ret);
}
static HRESULT Global_Round(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)

View File

@ -223,6 +223,13 @@ if isEnglishLang then
Call ok(WeekDayName(1, true, 2) = "Mon", "WeekDayName(1, true, 2) = " & WeekDayName(1, true, 2))
Call ok(WeekDayName(1, true, 7) = "Sat", "WeekDayName(1, true, 7) = " & WeekDayName(1, true, 7))
Call ok(WeekDayName(1, true, 7.1) = "Sat", "WeekDayName(1, true, 7.1) = " & WeekDayName(1, true, 7.1))
Call ok(MonthName(1) = "January", "MonthName(1) = " & MonthName(1))
Call ok(MonthName(12) = "December", "MonthName(12) = " & MonthName(12))
Call ok(MonthName(1, 0) = "January", "MonthName(1, 0) = " & MonthName(1, 0))
Call ok(MonthName(12, false) = "December", "MonthName(12, false) = " & MonthName(12, false))
Call ok(MonthName(1, 10) = "Jan", "MonthName(1, 10) = " & MonthName(1, 10))
Call ok(MonthName(12, true) = "Dec", "MonthName(12, true) = " & MonthName(12, true))
end if
Call reportSuccess()