Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

SCons attempt to add test

By: a guest on Mar 2nd, 2013  |  syntax: Diff  |  size: 3.71 KB  |  views: 37  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff -r 28ed0b62ee59 test/Configure/custom-tests.py
  2. --- a/test/Configure/custom-tests.py    Sat Mar 02 21:27:24 2013 +0000
  3. +++ b/test/Configure/custom-tests.py    Sat Mar 02 22:52:24 2013 +0000
  4. @@ -69,21 +69,75 @@
  5.      resOK = resOK and retActOK and int(outputActOK)==0
  6.      resFAIL = retCompileFAIL or retLinkFAIL or retRunFAIL or outputRunFAIL!=""
  7.      resFAIL = resFAIL or retActFAIL or outputActFAIL!=""
  8. -    test.Result( int(resOK and not resFAIL) )
  9. +    test.Result( resOK and not resFAIL )
  10.      return resOK and not resFAIL
  11.  
  12. +def CheckList(test):
  13. +    test.Message( 'Display of list ...' )
  14. +    res = [1, 2, 3, 4]
  15. +    test.Result( res )
  16. +    return res
  17. +
  18. +def CheckEmptyList(test):
  19. +    test.Message( 'Display of empty list ... ' )
  20. +    res = list()
  21. +    test.Result( res )
  22. +    return res
  23. +
  24. +def CheckRandomStr(test):
  25. +    test.Message( 'Display of random string ... ' )
  26. +    res = "a random string"
  27. +    test.Result( res )
  28. +    return res
  29. +
  30. +def CheckEmptyStr(test):
  31. +    test.Message( 'Display of empty string ... ' )
  32. +    res = ""
  33. +    test.Result( res )
  34. +    return res
  35. +
  36. +def CheckDict(test):
  37. +    test.Message( 'Display of dictionary ... ' )
  38. +    res = {"key1" : 1, "key2" : "text"}
  39. +    test.Result( res )
  40. +    return res
  41. +
  42. +def CheckEmptyDict(test):
  43. +    test.Message( 'Display of empty dictionary ... ' )
  44. +    res = dict
  45. +    test.Result( res )
  46. +    return res
  47. +
  48.  env = Environment()
  49.  import os
  50.  env.AppendENVPath('PATH', os.environ['PATH'])
  51. -conf = Configure( env, custom_tests={'CheckCustom' : CheckCustom} )
  52. +conf = Configure( env, custom_tests={'CheckCustom'    : CheckCustom,
  53. +                                     'CheckList'      : CheckList,
  54. +                                     'CheckEmptyList' : CheckEmptyList,
  55. +                                     'CheckRandomStr' : CheckRandomStr,
  56. +                                     'CheckEmptyStr'  : CheckEmptyStr,
  57. +                                     'CheckDict'      : CheckDict,
  58. +                                     'CheckEmptyDict' : CheckEmptyDict} )
  59.  conf.CheckCustom()
  60. +conf.CheckList()
  61. +conf.CheckEmptyList()
  62. +conf.CheckRandomStr()
  63. +conf.CheckEmptyStr()
  64. +conf.CheckDict()
  65. +conf.CheckEmptyDict()
  66.  env = conf.Finish()
  67.  """ % locals())
  68.  
  69.  test.run()
  70.  
  71. -test.checkLogAndStdout(["Executing MyTest ... "],
  72. -                      ["yes"],
  73. +test.checkLogAndStdout(["Executing MyTest ... ",
  74. +                        "Display of list ... ",
  75. +                        "Display of empty list ... ",
  76. +                        "Display of random string ... ",
  77. +                        "Display of empty string ... ",
  78. +                        "Display of dictionary ... ",
  79. +                        "Display of empty dictionary ... "],
  80. +                      ["yes", "yes", "no", "a random string", "", "yes", "no"],
  81.                        [[(('.c', NCR), (_obj, NCR)),
  82.                          (('.c', NCR), (_obj, NCF)),
  83.                          (('.c', NCR), (_obj, NCR), (_exe, NCR)),
  84. @@ -96,8 +150,14 @@
  85.  
  86.  test.run()
  87.  
  88. -test.checkLogAndStdout(["Executing MyTest ... "],
  89. -                      ["yes"],
  90. +test.checkLogAndStdout(["Executing MyTest ... ",
  91. +                        "Display of list ... ",
  92. +                        "Display of empty list ... ",
  93. +                        "Display of random string ... ",
  94. +                        "Display of empty string ... ",
  95. +                        "Display of dictionary ... ",
  96. +                        "Display of empty dictionary ... "],
  97. +                      ["yes", "yes", "no", "a random string", "", "yes", "no"],
  98.                        [[(('.c', CR), (_obj, CR)),
  99.                          (('.c', CR), (_obj, CF)),
  100.                          (('.c', CR), (_obj, CR), (_exe, CR)),