diff -r 28ed0b62ee59 test/Configure/custom-tests.py --- a/test/Configure/custom-tests.py Sat Mar 02 21:27:24 2013 +0000 +++ b/test/Configure/custom-tests.py Sat Mar 02 22:52:24 2013 +0000 @@ -69,21 +69,75 @@ resOK = resOK and retActOK and int(outputActOK)==0 resFAIL = retCompileFAIL or retLinkFAIL or retRunFAIL or outputRunFAIL!="" resFAIL = resFAIL or retActFAIL or outputActFAIL!="" - test.Result( int(resOK and not resFAIL) ) + test.Result( resOK and not resFAIL ) return resOK and not resFAIL +def CheckList(test): + test.Message( 'Display of list ...' ) + res = [1, 2, 3, 4] + test.Result( res ) + return res + +def CheckEmptyList(test): + test.Message( 'Display of empty list ... ' ) + res = list() + test.Result( res ) + return res + +def CheckRandomStr(test): + test.Message( 'Display of random string ... ' ) + res = "a random string" + test.Result( res ) + return res + +def CheckEmptyStr(test): + test.Message( 'Display of empty string ... ' ) + res = "" + test.Result( res ) + return res + +def CheckDict(test): + test.Message( 'Display of dictionary ... ' ) + res = {"key1" : 1, "key2" : "text"} + test.Result( res ) + return res + +def CheckEmptyDict(test): + test.Message( 'Display of empty dictionary ... ' ) + res = dict + test.Result( res ) + return res + env = Environment() import os env.AppendENVPath('PATH', os.environ['PATH']) -conf = Configure( env, custom_tests={'CheckCustom' : CheckCustom} ) +conf = Configure( env, custom_tests={'CheckCustom' : CheckCustom, + 'CheckList' : CheckList, + 'CheckEmptyList' : CheckEmptyList, + 'CheckRandomStr' : CheckRandomStr, + 'CheckEmptyStr' : CheckEmptyStr, + 'CheckDict' : CheckDict, + 'CheckEmptyDict' : CheckEmptyDict} ) conf.CheckCustom() +conf.CheckList() +conf.CheckEmptyList() +conf.CheckRandomStr() +conf.CheckEmptyStr() +conf.CheckDict() +conf.CheckEmptyDict() env = conf.Finish() """ % locals()) test.run() -test.checkLogAndStdout(["Executing MyTest ... "], - ["yes"], +test.checkLogAndStdout(["Executing MyTest ... ", + "Display of list ... ", + "Display of empty list ... ", + "Display of random string ... ", + "Display of empty string ... ", + "Display of dictionary ... ", + "Display of empty dictionary ... "], + ["yes", "yes", "no", "a random string", "", "yes", "no"], [[(('.c', NCR), (_obj, NCR)), (('.c', NCR), (_obj, NCF)), (('.c', NCR), (_obj, NCR), (_exe, NCR)), @@ -96,8 +150,14 @@ test.run() -test.checkLogAndStdout(["Executing MyTest ... "], - ["yes"], +test.checkLogAndStdout(["Executing MyTest ... ", + "Display of list ... ", + "Display of empty list ... ", + "Display of random string ... ", + "Display of empty string ... ", + "Display of dictionary ... ", + "Display of empty dictionary ... "], + ["yes", "yes", "no", "a random string", "", "yes", "no"], [[(('.c', CR), (_obj, CR)), (('.c', CR), (_obj, CF)), (('.c', CR), (_obj, CR), (_exe, CR)),