OSDN Git Service

Version 3.00
[vbslib/main.git] / _src / _replica / vbslib / TestScript.vbs
diff --git a/_src/_replica/vbslib/TestScript.vbs b/_src/_replica/vbslib/TestScript.vbs
deleted file mode 100644 (file)
index 735d37a..0000000
+++ /dev/null
@@ -1,792 +0,0 @@
-Option Explicit \r
-\r
-' vbslib  ver2.00 2008/8/17\r
-' Copyright (c) 2008, T's-Neko\r
-' All rights reserved. 3-clause BSD license.\r
-\r
-\r
-' Global Variable\r
-Dim  g_Test, g_echo_on\r
-\r
-Function  InitializeModule\r
-  g_echo_on = True\r
-  Set  g_Test = New TestScript\r
-End Function\r
-Dim  g_InitializeModule\r
-Set  g_InitializeModule = GetRef( "InitializeModule" )\r
-\r
-Const  Err_TestPass = 21\r
-Const  Err_TestSkip = 22\r
-Const  Err_TestFail = 23\r
-\r
\r
-'********************************************************************************\r
-'  <<< [call_vbs_t] >>> \r
-'   - The difference of call_vbs is not depend on vbslib.\r
-'   - path, func as string, param as variant\r
-'********************************************************************************\r
-Function  call_vbs_t( ByVal path, ByVal func, ByVal param )\r
-  Dim oldDir, f, funcX, in_interpret, en, ed, es\r
-\r
-  in_interpret = False\r
-  oldDir = g_sh.CurrentDirectory\r
-\r
-  path = g_sh.ExpandEnvironmentStrings( path )\r
-  path = g_fs.GetAbsolutePathName( path )\r
-\r
-  '-----------------------------------------\r
-  ' Interpret\r
-  On Error Resume Next  'try\r
-    g_sh.CurrentDirectory = g_fs.GetParentFolderName( path )\r
-    If Err=0 Then  Set f = g_fs.OpenTextFile( g_fs.GetFileName( path ) )\r
-    If Err=0 Then  in_interpret = True : ExecuteGlobal f.ReadAll()\r
-    If Err=&h411 Then  in_interpret = False : Err.Clear  ' Ignore symbol override error\r
-    If Err=0 Then  in_interpret = False\r
-    If Err=0 Then  Set funcX = GetRef( func )\r
-\r
-  en = Err.Number : es = Err.Source : ed = Err.Description : On Error GoTo 0 : If en <> 0 Then  'catch\r
-    If in_interpret Then\r
-      ed = ed + " Syntax ERROR in """ + g_fs.GetFileName( path ) _\r
-              + """. Please double click """ _\r
-              + g_fs.GetFileName( path ) + """."\r
-    End If\r
-    If en = &h35 Then  ed = "Not found file '" + path\r
-    If en = 5 Then  ed = "Not found func name '" + func + "' in " + path\r
-  End If\r
-\r
-\r
-  '-----------------------------------------\r
-  ' Call\r
-  If en = 0 Then\r
-    On Error Resume Next  'try\r
-      call_vbs_t = funcX( param )\r
-    en = Err.Number : es = Err.Source : ed = Err.Description : On Error GoTo 0 : If en <> 0 Then  'catch\r
-      If en = Err_TestPass Then\r
-        en = 0\r
-      Else\r
-        ed = ed + " - Runtime ERROR in the function of """ + func + """ in """ _\r
-           + GetStepPath( path, g_fs.GetParentFolderName( WScript.ScriptFullName ) ) + """."\r
-      End If\r
-    End If\r
-  End If\r
-\r
-\r
-  '-----------------------------------------\r
-  ' Finally\r
-  f.Close\r
-  g_sh.CurrentDirectory = oldDir\r
-\r
-  If en <> 0 Then  Err.Raise en, es, ed\r
-End Function\r
-\r
-\r
-\r
\r
-'********************************************************************************\r
-'  <<< [call_vbs_d] >>> \r
-'********************************************************************************\r
-Function  call_vbs_d( ByVal path, ByVal func, ByVal param )\r
-  Dim oldDir, f, funcX, in_call, in_interpret, en\r
-\r
-  oldDir = g_sh.CurrentDirectory\r
-\r
-  path = g_sh.ExpandEnvironmentStrings( path )\r
-  path = g_fs.GetAbsolutePathName( path )\r
-\r
-  g_sh.CurrentDirectory = g_fs.GetParentFolderName( path )\r
-\r
-  Set f = g_fs.OpenTextFile( g_fs.GetFileName( path ) )\r
-  ExecuteGlobal f.ReadAll()\r
-  Set funcX = GetRef( func )  ' If error, Not found func symbol\r
-  call_vbs_d = funcX( param )\r
-  f.Close\r
-  g_sh.CurrentDirectory = oldDir\r
-End Function\r
-\r
-\r
-\r
\r
-'*-------------------------------------------------------------------------*\r
-'* \81\9f<<<< [TestScript] Class >>>> */ \r
-'*-------------------------------------------------------------------------*\r
-\r
-Class  TestScript\r
-  Public  m_nPass  ' as integer\r
-  Public  m_nSkip  ' as integer\r
-  Public  m_nFail  ' as integer\r
-  Public  m_Log    ' as Text File\r
-  Public  m_DefLogFName  ' as string\r
-  Public  m_ManualTests() ' as string\r
-  Public  m_Debug  ' as boolean\r
-  Public  m_Pass   ' as boolean\r
\r
-'********************************************************************************\r
-'  <<< [TestScript::Class_Initialize] >>> \r
-'********************************************************************************\r
-Private Sub  Class_Initialize\r
-  m_DefLogFName = "Test_logs.txt"\r
-  m_Debug = g_Debug\r
-  ReDim  m_ManualTests(-1)\r
-End Sub\r
-\r
-\r
\r
-'********************************************************************************\r
-'  <<< [TestScript::Class_Terminate] >>> \r
-'********************************************************************************\r
-Private Sub  Class_Terminate\r
-  If Not IsEmpty( m_Log ) Then  Finish\r
-End Sub\r
-\r
-\r
\r
-'********************************************************************************\r
-'  <<< [TestScript::Start] >>> \r
-'********************************************************************************\r
-Public Sub  Start\r
-  Dim  sub_test ' Boolean\r
-\r
-  Set m_Log = g_fs.CreateTextFile( m_DefLogFName, True, False )\r
-  ReDim  m_ManualTests(-1)\r
-\r
-  sub_test = False\r
-  If WScript.Arguments.Count >= 1 Then\r
-    If WScript.Arguments(0) = "-sub_test" Then sub_test = True\r
-  End If\r
-\r
-  If Not sub_test Then  echo  "Test Start : " & g_fs.GetFileName( Wscript.ScriptFullName )\r
-\r
-  m_nPass = 0\r
-  m_nSkip = 0\r
-  m_nFail = 0\r
-End Sub\r
-\r
-\r
\r
-'********************************************************************************\r
-'  <<< [TestScript::Do_] >>> \r
-'********************************************************************************\r
-Public Sub  Do_( ByVal vbs_path, ByVal func, ByVal param )\r
-  Dim  e,ed,es, DefLogFName\r
-\r
-  If g_debug Then  Debug  vbs_path, func, param :  Exit Sub\r
-\r
-  If IsEmpty( m_Log ) And func <> "test_current" Then\r
-    DefLogFName = m_DefLogFName\r
-    m_DefLogFName = g_fs.GetParentFolderName( vbs_path ) + "\" + DefLogFName\r
-    Start\r
-  End If\r
-\r
-  If func <> "test_current" Then\r
-    echo "=========================================================="\r
-    If g_fs.GetFileName( g_fs.GetParentFolderName( vbs_path ) ) = "" Then\r
-      echo "<<< [" & g_fs.GetFileName( vbs_path ) & "] - " & func & " >>>"\r
-    Else\r
-      echo "<<< [" & g_fs.GetFileName( g_fs.GetParentFolderName( vbs_path ) ) & "\" _\r
-           & g_fs.GetFileName( vbs_path ) & "] - " & func & " >>>"\r
-    End If\r
-  End If\r
-\r
-  On Error Resume Next\r
-    call_vbs_t  vbs_path, func, param\r
-    If Err.Number=0 And Not m_Pass Then  Err.Raise  Err_TestFail, "VBSLib TestScript", _\r
-      "No result" + " - Runtime ERROR in the function of """ + func + """ in """ + _\r
-      g_fs.GetFileName( vbs_path ) + """."\r
-  e = Err.Number : ed = Err.Description : es = Err.Source : On Error GoTo 0 : If e <> 0 Then\r
-    If e = Err_TestSkip Then\r
-      m_nSkip = m_nSkip + 1\r
-      echo "[Skip] " & ed\r
-      echo " in """ & vbs_path & """"\r
-    ElseIf e = Err_TestFail Then\r
-      m_nFail = m_nFail + 1\r
-      echo "[Fail] " & ed\r
-      echo " in """ & vbs_path & """"\r
-    Else\r
-      m_nFail = m_nFail + 1\r
-      If e >= 0 And e <= &h7fff Then  e = e + &h800A0000\r
-      echo "[Fail] [Error] (" & Hex(e) & ") " & ed\r
-      echo " in """ & vbs_path & """"\r
-    End If\r
-    e = Empty\r
-  Else\r
-    If func <> "test_current" Then\r
-      m_nPass = m_nPass + 1\r
-      echo "Pass."\r
-    End If\r
-  End If\r
-\r
-  If Not IsEmpty( DefLogFName ) Then\r
-    Finish\r
-    m_DefLogFName = DefLogFName\r
-  End If\r
-\r
-End Sub\r
-\r
-\r
\r
-'********************************************************************************\r
-'  <<< [TestScript::Debug] >>> \r
-'********************************************************************************\r
-Public Sub  Debug( ByVal vbs_path, ByVal func, ByVal param )\r
-  echo "=========================================================="\r
-  echo "<<< [" & g_fs.GetFileName( g_fs.GetParentFolderName( vbs_path ) ) & "\" _\r
-           & g_fs.GetFileName( vbs_path ) & "] - " & func & " >>>"\r
-  echo "Debug Mode ..."\r
-\r
-  m_Debug = True\r
-  call_vbs_d  vbs_path, func, param\r
-  m_Debug = False\r
-\r
-  if m_Pass Then\r
-    If func <> "test_current" Then\r
-      m_nPass = m_nPass + 1\r
-      echo "Pass."\r
-    End If\r
-  End If\r
-End Sub\r
-\r
-\r
\r
-'********************************************************************************\r
-'  <<< [TestScript::AddManualTest] >>> \r
-'********************************************************************************\r
-Public Sub  AddManualTest( TestSymbol )\r
-  ReDim Preserve  m_ManualTests( UBound( m_ManualTests ) + 1 )\r
-  m_ManualTests( UBound( m_ManualTests ) ) = TestSymbol\r
-End Sub\r
-\r
-\r
\r
-'********************************************************************************\r
-'  <<< [TestScript::Finish] >>> \r
-'********************************************************************************\r
-Public Sub  Finish\r
-  Dim  TestSymbol, sub_test ' Boolean\r
-\r
-  For Each TestSymbol In m_ManualTests\r
-    echo  "[ManualTest] " + TestSymbol\r
-  Next\r
-\r
-  sub_test = False\r
-  If WScript.Arguments.Count >= 1 Then\r
-    If WScript.Arguments(0) = "-sub_test" Then sub_test = True\r
-  End If\r
-\r
-  If sub_test Then\r
-    If m_nFail = 0 Then WScript.Quit 0  Else WScript.Quit 1  End If\r
-  Else\r
-    echo "=========================================================="\r
-    echo "Test Finish (Pass=" & m_nPass & ", Manual=" & UBound(m_ManualTests)+1 & _\r
-         ", Skip=" & m_nSkip & ", Fail=" & m_nFail & ")"\r
-    echo ""\r
-  End If\r
-\r
-  m_Log = Empty\r
-End Sub\r
-\r
-\r
-\r
-\r
-\r
\r
-End Class \r
\r
-'*-------------------------------------------------------------------------*\r
-'* \81\9f<<<< [Tests] Class >>>> */ \r
-'*-------------------------------------------------------------------------*\r
-Class Tests\r
-\r
-  Private  m_Sets  ' As Dictionary of UnitTest. key is UnitTest::Symbol\r
-  Private  m_BaseFolderPath  ' as string. All Test ROOT\r
-  Private  m_Prompt  ' as TestPrompt or Empty\r
-  Private  m_CurrentSymbol  ' as string of current test symbol or ALL or ALL_R\r
-  Private  m_CurrentSubSymbol  ' as string\r
-  Private  m_CurrentTest   ' as UnitTest of m_CurrentSymbol\r
-  Public   CurrentTestPriority   ' as integer  small is high priority\r
-  Private  m_bAllTest  ' as boolean\r
-  Private  m_AllFName  ' as string\r
-  Private  m_Symbol  ' as string of doing test symbol\r
-  Public   bTargetDebug  ' as boolean\r
-  Public   c_ErrDblSymbol  ' as const number\r
-\r
-  '----------------------------------\r
-  Public Property Get  Sets : Set Sets = m_Sets : End Property\r
-  Public Property Get  BaseFolderPath : BaseFolderPath = m_BaseFolderPath : End Property\r
-  Public Property Let  BaseFolderPath( x ) : m_BaseFolderPath = x : End Property\r
-  Public Property Set  Prompt( x ) : Set m_Prompt = x : End Property\r
-  Public Property Get  Prompt : Set Prompt = m_Prompt : End Property\r
-  Public Property Get  CurrentSymbol : CurrentSymbol = m_CurrentSymbol : End Property\r
-  Public Property Get  CurrentTest : If IsObject(m_CurrentTest) Then Set CurrentTest = m_CurrentTest : Else CurrentTest = m_CurrentTest : End If : End Property\r
-  Public Property Get  bAllTest : bAllTest = m_bAllTest : End Property\r
-  Public Property Get  Symbol : Symbol = m_Symbol : End Property\r
\r
-'********************************************************************************\r
-'  <<< [Tests::Class_Initialize] >>> \r
-'********************************************************************************\r
-Private  Sub  Class_Initialize\r
-  Set m_Sets = CreateObject("Scripting.Dictionary")\r
-  m_BaseFolderPath = g_fs.GetParentFolderName( WScript.ScriptFullName )\r
-  m_CurrentSymbol = "ALL"\r
-  m_AllFName = "T_ALL.vbs"\r
-  m_bAllTest = False\r
-  bTargetDebug = False\r
-  c_ErrDblSymbol = 1010\r
-End Sub\r
-\r
\r
-'********************************************************************************\r
-'  <<< [Tests::AddTestScriptAuto] >>> \r
-'********************************************************************************\r
-Public Function  AddTestScriptAuto( BasePath, FName )\r
-  m_AllFName = FName\r
-  AddTestScriptAuto_EnumSubFolders  g_fs.GetFolder( BasePath ), FName\r
-End Function\r
-\r
-\r
-Private Sub AddTestScriptAuto_EnumSubFolders( fo, FName )\r
-  Dim  subfo\r
-\r
-  If g_fs.FileExists( fo.Path + "\" + FName ) Then\r
-    AddTestScript  g_fs.GetFileName( fo.Path ), fo.Path + "\" + FName\r
-  End If\r
-  For Each subfo in fo.SubFolders\r
-    AddTestScriptAuto_EnumSubFolders subfo, FName\r
-  Next\r
-End Sub\r
\r
-'********************************************************************************\r
-'  <<< [Tests::AddTestScript] >>> \r
-'********************************************************************************\r
-Public Function  AddTestScript( Symbol, Path )\r
-  Dim  test\r
-\r
-  If Not g_fs.FileExists( Path ) Then  Err.Raise 53,,"\83t\83@\83C\83\8b\82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ " + Path\r
-\r
-  Set test = New UnitTest\r
-  test.Symbol = Symbol\r
-  test.ScriptPath = g_fs.GetAbsolutePathName( Path )\r
-  If m_Sets.Exists( test.Symbol ) Then _\r
-    Err.Raise c_ErrDblSymbol,"class Tests", "[ERROR] Already defined the symbol '"+Symbol+"' in "+ _\r
-    m_Sets.Item(Symbol).ScriptPath\r
-  m_Sets.Add  test.Symbol, test\r
-\r
-  Me.CurrentTestPriority = 1000\r
-  If g_debug Then  call_vbs_d  Path, "test_current", Me _\r
-  Else             call_vbs_t  Path, "test_current", Me\r
-  test.Priority = Me.CurrentTestPriority\r
-\r
-  Set AddTestScript = test\r
-End Function\r
-\r
\r
-'********************************************************************************\r
-'  <<< [Tests::SetCurrentSymbol] >>> \r
-'********************************************************************************\r
-Public Function SetCurrentSymbol( Symbol_or_Path )\r
-  Dim  key, item, b\r
-\r
-  SetCurrentSymbol = 0\r
-\r
-  '// ALL and ALL_R is special symbol\r
-  If Symbol_or_Path = "ALL" or Symbol_or_Path = "ALL_R" Then  m_CurrentSymbol = Symbol_or_Path : _\r
-    m_CurrentTest = Empty : Exit Function\r
-\r
-  '// Search by test symbol\r
-  For Each key in m_Sets.Keys()\r
-    If key = Symbol_or_Path Then  m_CurrentSymbol = Symbol_or_Path : _\r
-      Set m_CurrentTest = m_Sets.Item( m_CurrentSymbol ) : Exit Function\r
-  Next\r
-\r
-  '// Search by path\r
-  For Each item in m_Sets.Items()\r
-    If item.ScriptPath = Symbol_or_Path Then  m_CurrentSymbol = item.Symbol : _\r
-      Set m_CurrentTest = m_Sets.Item( m_CurrentSymbol ) : Exit Function\r
-  Next\r
-\r
-  '// If Symbol is path, Add test symbol\r
-  If g_fs.FileExists( Symbol_or_Path ) Then\r
-    If UCase(g_fs.GetFileName( Symbol_or_Path )) = UCase(m_AllFName) Then _\r
-      m_CurrentSymbol = g_fs.GetFileName( g_fs.GetParentFolderName( g_fs.GetAbsolutePathName(Symbol_or_Path) ) ) _\r
-    Else  m_CurrentSymbol = g_fs.GetBaseName( Symbol_or_Path )\r
-\r
-    b = True : If m_Sets.Exists( m_CurrentSymbol ) Then _\r
-      b = ( m_Sets.Item( m_CurrentSymbol ).ScriptPath <> g_fs.GetAbsolutePathName( Symbol_or_Path ) )\r
-    If b Then  'If Not m_Sets.Exists( m_CurrentSymbol ) or _\r
-               '  m_Sets.Item( m_CurrentSymbol ).ScriptPath <> g_fs.GetAbsolutePathName( Symbol_or_Path ) Then\r
-      AddTestScript  m_CurrentSymbol, Symbol_or_Path\r
-    End If\r
-    Set m_CurrentTest = m_Sets.Item( m_CurrentSymbol )\r
-    Exit Function\r
-  End If\r
-\r
-  '// Error: Symbol\r
-  echo "[ERROR] Not found symbol or path """ + Symbol_or_Path + """. CurrentDirectory = " & g_sh.CurrentDirectory\r
-  SetCurrentSymbol = 1\r
-End Function\r
-\r
-\r
\r
-'********************************************************************************\r
-'  <<< [Tests::DoTest] >>> \r
-'********************************************************************************\r
-Public Sub  DoTest( Func, bReverse )\r
-  If m_CurrentSymbol = "ALL" Or m_CurrentSymbol = "ALL_R" Then\r
-    Redim  utests(-1)\r
-\r
-    If bReverse Then\r
-      ShakerSort_fromDic  m_Sets, utests, -1, GetRef("CmpUnitTestPriorityDec"), Empty\r
-    Else\r
-      ShakerSort_fromDic  m_Sets, utests, +1, GetRef("CmpUnitTestPriorityInc"), Empty\r
-    End If\r
-\r
-    g_Test.m_DefLogFName = m_BaseFolderPath + "\" + g_fs.GetFileName( g_Test.m_DefLogFName )\r
-    g_Test.Start\r
-    For Each m_CurrentTest in utests\r
-      TestCurrentSetup\r
-      g_Test.Do_  m_CurrentTest.ScriptPath, "test_current", Me\r
-      TestSetup\r
-      g_Test.Do_  m_CurrentTest.ScriptPath, Func, Me\r
-    Next\r
-    g_Test.Finish\r
-  Else\r
-    g_Test.m_DefLogFName = g_fs.GetParentFolderName( m_CurrentTest.ScriptPath ) + "\" + g_fs.GetFileName( g_Test.m_DefLogFName )\r
-    g_Test.Start\r
-    Set m_CurrentTest = m_Sets.Item( m_CurrentSymbol )\r
-    TestCurrentSetup\r
-    g_Test.Do_  m_CurrentTest.ScriptPath, "test_current", Me\r
-    TestSetup\r
-    g_Test.Do_  m_CurrentTest.ScriptPath, Func, Me\r
-    g_Test.Finish\r
-  End If\r
-End Sub\r
-\r
\r
-'********************************************************************************\r
-'  <<< [Tests::DebugTest] >>> \r
-'********************************************************************************\r
-Public Sub  DebugTest( Func, bReverse )\r
-  If m_CurrentSymbol = "ALL" Or m_CurrentSymbol = "ALL_R" Then\r
-    Dim  items(), i\r
-\r
-    i = m_Sets.Count - 1\r
-    ReDim Preserve items( i )\r
-    If bReverse Then\r
-      For Each m_CurrentTest in m_Sets.Items()\r
-        Set items( i ) = m_CurrentTest\r
-        i = i - 1\r
-      Next\r
-    Else\r
-      i = 0\r
-      For Each m_CurrentTest in m_Sets.Items()\r
-        Set items( i ) = m_CurrentTest\r
-        i = i + 1\r
-      Next\r
-    End If\r
-\r
-    g_Test.m_DefLogFName = m_BaseFolderPath + "\" + g_fs.GetFileName( g_Test.m_DefLogFName )\r
-    g_Test.Start\r
-    For Each m_CurrentTest in items\r
-      TestCurrentSetup\r
-      g_Test.Debug  m_CurrentTest.ScriptPath, "test_current", Me\r
-      TestSetup\r
-      g_Test.Debug  m_CurrentTest.ScriptPath, Func, Me\r
-    Next\r
-    g_Test.Finish\r
-  Else\r
-    g_Test.m_DefLogFName = g_fs.GetParentFolderName( m_CurrentTest.ScriptPath ) + "\" + g_fs.GetFileName( g_Test.m_DefLogFName )\r
-    g_Test.Start\r
-    Set m_CurrentTest = m_Sets.Item( m_CurrentSymbol )\r
-    TestCurrentSetup\r
-    g_Test.Debug  m_CurrentTest.ScriptPath, "test_current", Me\r
-    TestSetup\r
-    g_Test.Debug  m_CurrentTest.ScriptPath, Func, Me\r
-    g_Test.Finish\r
-  End If\r
-End Sub\r
-\r
\r
-'********************************************************************************\r
-'  <<< [Tests::DoAllTest] >>> \r
-'********************************************************************************\r
-Public Sub  DoAllTest()\r
-  m_bAllTest = True\r
-  If m_CurrentSymbol = "ALL" Or m_CurrentSymbol = "ALL_R" Then\r
-    Redim  utests_inc(-1), utests_dec(-1)\r
-\r
-    ShakerSort_fromDic  m_Sets, utests_inc, +1, GetRef("CmpUnitTestPriorityInc"), Empty\r
-    ShakerSort_fromDic  m_Sets, utests_dec, -1, GetRef("CmpUnitTestPriorityDec"), Empty\r
-\r
-    g_Test.m_DefLogFName = m_BaseFolderPath + "\" + g_fs.GetFileName( g_Test.m_DefLogFName )\r
-    g_Test.Start\r
-\r
-    For Each m_CurrentTest in utests_inc\r
-      TestCurrentSetup\r
-      g_Test.Do_  m_CurrentTest.ScriptPath, "test_current", Me\r
-    Next\r
-    For Each m_CurrentTest in utests_inc\r
-      TestSetup\r
-      g_Test.Do_  m_CurrentTest.ScriptPath, "test_build", Me\r
-    Next\r
-    For Each m_CurrentTest in utests_inc\r
-      TestSetup\r
-      g_Test.Do_  m_CurrentTest.ScriptPath, "test_setup", Me\r
-    Next\r
-    For Each m_CurrentTest in utests_dec\r
-      TestSetup\r
-      g_Test.Do_  m_CurrentTest.ScriptPath, "test_start", Me\r
-    Next\r
-    For Each m_CurrentTest in utests_dec\r
-      TestSetup\r
-      g_Test.Do_  m_CurrentTest.ScriptPath, "test_check", Me\r
-    Next\r
-    For Each m_CurrentTest in utests_dec\r
-      TestSetup\r
-      g_Test.Do_  m_CurrentTest.ScriptPath, "test_clean", Me\r
-    Next\r
-    g_Test.Finish\r
-  Else\r
-    Set m_CurrentTest = m_Sets.Item( m_CurrentSymbol )\r
-    g_Test.m_DefLogFName = g_fs.GetParentFolderName( m_CurrentTest.ScriptPath ) + "\" + g_fs.GetFileName( g_Test.m_DefLogFName )\r
-    g_Test.Start\r
-    TestCurrentSetup\r
-    g_Test.Do_  m_CurrentTest.ScriptPath, "test_current", Me\r
-    TestSetup\r
-    g_Test.Do_  m_CurrentTest.ScriptPath, "test_build", Me\r
-    TestSetup\r
-    g_Test.Do_  m_CurrentTest.ScriptPath, "test_setup", Me\r
-    TestSetup\r
-    g_Test.Do_  m_CurrentTest.ScriptPath, "test_start", Me\r
-    TestSetup\r
-    g_Test.Do_  m_CurrentTest.ScriptPath, "test_check", Me\r
-    TestSetup\r
-    g_Test.Do_  m_CurrentTest.ScriptPath, "test_clean", Me\r
-    g_Test.Finish\r
-  End If\r
-  m_bAllTest = False\r
-End Sub\r
-\r
-\r
\r
-'********************************************************************************\r
-'  <<< [Tests::TestCurrentSetup] >>> \r
-'********************************************************************************\r
-Private Sub  TestCurrentSetup()\r
-  m_Symbol = m_CurrentTest.Symbol\r
-  CurrentTestPriority = m_CurrentTest.Priority\r
-  g_Test.m_Pass = True\r
-End Sub\r
-\r
\r
-'********************************************************************************\r
-'  <<< [Tests::TestSetup] >>> \r
-'********************************************************************************\r
-Private Sub  TestSetup()\r
-  m_Symbol = m_CurrentTest.Symbol\r
-  g_Test.m_Pass = False\r
-End Sub\r
-\r
\r
-'********************************************************************************\r
-'  <<< [Tests::SetCur] >>> \r
-'********************************************************************************\r
-Public Sub  SetCur( SubSymbol )\r
-  m_CurrentSubSymbol = SubSymbol\r
-End Sub\r
-\r
\r
-'********************************************************************************\r
-'  <<< [Tests::IsCur] >>> \r
-'********************************************************************************\r
-Public Function  IsCur( SubSymbol )\r
-  If m_CurrentSubSymbol = "ALL" Or m_CurrentSubSymbol = "ALL_R" Or _\r
-     m_CurrentSubSymbol = SubSymbol Then\r
-    IsCur = True\r
-  Else\r
-    IsCur = False\r
-  End IF\r
-End Function\r
-\r
\r
-End Class \r
\r
-'********************************************************************************\r
-'  <<< [CmpUnitTestPriorityInc] >>> \r
-'********************************************************************************\r
-Function  CmpUnitTestPriorityInc( left, right, param )\r
-  CmpUnitTestPriorityInc = left.Priority - right.Priority\r
-End Function\r
\r
-'********************************************************************************\r
-'  <<< [CmpUnitTestPriorityDec] >>> \r
-'********************************************************************************\r
-Function  CmpUnitTestPriorityDec( left, right, param )\r
-  CmpUnitTestPriorityDec = right.Priority - left.Priority\r
-End Function\r
\r
-'*-------------------------------------------------------------------------*\r
-'* \81\9f<<<< [UnitTest] Class >>>> */ \r
-'*-------------------------------------------------------------------------*\r
-Class UnitTest\r
-\r
-  Public  Symbol     ' As String\r
-  Public  ScriptPath ' As String\r
-  Public  Priority   ' As Integer\r
-\r
-  '----------------------------------\r
-  Private  Sub  Class_Initialize\r
-    Symbol = "NoSymbol"\r
-    ScriptPath = ""\r
-  End Sub\r
-\r
-  Public  Function  Value\r
-    Value = "[" & Symbol & "]" & vbCR & vbLF & " " & ScriptPath\r
-  End Function\r
-\r
-  Public Function  PathToAbs( BaseFolderPath )\r
-    Dim  s\r
-    PathToAbs = True\r
-    s = g_fs.GetAbsolutePathName( BaseFolderPath & "\" & ScriptPath )\r
-    If Not g_fs.FileExists( s ) Then  echo "[ERROR] Not found " + ScriptPath + ", Base=" + BaseFolderPath : PathToAbs = False\r
-    ScriptPath = s\r
-  End Function\r
-\r
-End Class\r
-\r
-\r
\r
-'*-------------------------------------------------------------------------*\r
-'* \81\9f<<<< Test Result >>>> */ \r
-'*-------------------------------------------------------------------------*\r
-\r
\r
-'********************************************************************************\r
-'  <<< [Pass] >>> \r
-'********************************************************************************\r
-Sub  Pass\r
-  If IsEmpty( g_Test ) Then\r
-    WScript.Quit  Err_TestPass\r
-  ElseIf IsEmpty( g_Test.m_Log ) Then\r
-    WScript.Echo  "Pass"\r
-    WScript.Quit  Err_TestPass\r
-  Else\r
-    g_Test.m_Pass = True\r
-  End If\r
-End Sub\r
-\r
-\r
-\r
\r
-'********************************************************************************\r
-'  <<< [Fail] >>> \r
-'********************************************************************************\r
-Sub  Fail()\r
-  If IsEmpty( g_Test ) Then\r
-    WScript.Quit  Err_TestFail\r
-  ElseIf IsEmpty( g_Test.m_Log ) Then\r
-    WScript.Echo  "Fail"\r
-    WScript.Quit  Err_TestFail\r
-  Else\r
-    Err.Raise  Err_TestFail, "VBSLib TestScript", "Fail the Test"\r
-  End If\r
-End Sub\r
-\r
-\r
-\r
\r
-'********************************************************************************\r
-'  <<< [Skip] >>> \r
-'********************************************************************************\r
-Sub  Skip()\r
-  If IsEmpty( g_Test ) Then\r
-    WScript.Quit  Err_TestSkip\r
-  ElseIf IsEmpty( g_Test.m_Log ) Then\r
-    WScript.Echo  "Skip"\r
-    WScript.Quit  Err_TestSkip\r
-  Else\r
-    Err.Raise  Err_TestSkip, "VBSLib TestScript", "Skip the Test"\r
-  End If\r
-End Sub\r
-\r
-\r
-\r
\r
-'********************************************************************************\r
-'  <<< [ManualTest] >>> \r
-'********************************************************************************\r
-Sub  ManualTest( TestSymbol )\r
-  echo  "<<< ["+TestSymbol+"] >>>"\r
-  echo  "This is ManualTest."\r
-  g_Test.AddManualTest  TestSymbol\r
-End Sub\r
-\r
\r
-'*-------------------------------------------------------------------------*\r
-'* \81\9f<<<< Tools for Test Program >>>> */ \r
-'*-------------------------------------------------------------------------*\r
-\r
\r
-'********************************************************************************\r
-'  <<< [EchoTestStart] >>> \r
-'********************************************************************************\r
-Sub  EchoTestStart( TestSymbol )\r
-  echo  "<<< ["+TestSymbol+"] >>>"\r
-End Sub\r
-\r
-\r
\r
-'********************************************************************************\r
-'  <<< [echo] >>> \r
-' return: output message\r
-'********************************************************************************\r
-Function  echo( ByVal msg )\r
-  If IsObject( msg ) Then  msg = msg.Value\r
-\r
-  WScript.Echo  msg\r
-  If Not IsEmpty( g_Test.m_Log ) Then  g_Test.m_Log.WriteLine  msg\r
-  echo = msg\r
-End Function\r
-\r
-\r
\r
-'********************************************************************************\r
-'  <<< [CheckTestErrLevel] >>> \r
-'********************************************************************************\r
-Sub  CheckTestErrLevel( r )\r
-  If r = Err_TestSkip Then\r
-    Skip\r
-  ElseIf r <> Err_TestPass Then\r
-    Fail\r
-  End If\r
-End Sub\r
-\r
-\r
\r
-'********************************************************************************\r
-'  <<< [ConvertToAbsPath] >>> \r
-'********************************************************************************\r
-Sub  ConvertToAbsPath( SrcPath, DstPath )\r
-  Dim  src, dst, dst_parent, line, p1, p2, path\r
-\r
-  Set  src = g_fs.OpenTextFile( SrcPath )\r
-  mkdir  g_fs.GetParentFolderName( g_fs.GetAbsolutePathName( DstPath ) )\r
-  Set  dst = g_fs.CreateTextFile( DstPath, True, False )\r
-\r
-  Do Until src.AtEndOfStream\r
-    line = src.ReadLine\r
-    Do\r
-      p1 = InStr( line, "%AbsPath(" )\r
-      If p1 = 0 Then Exit Do\r
-      p2 = InStr( p1 + 9, line, ")%" )\r
-      path = Mid( line, p1+9, p2-p1-9 )\r
-      path = GetAbsPath( path, g_fs.GetParentFolderName( g_fs.GetAbsolutePathName( SrcPath ) ) )\r
-      line = Left( line, p1 - 1 ) + path + Mid( line, p2 + 2 )\r
-    Loop\r
-    line = Replace( line, "%DesktopPath%", g_sh.SpecialFolders("Desktop") )\r
-    dst.WriteLine  line\r
-  Loop\r
-DstPath = "a"\r
-  src = Empty\r
-  dst = Empty\r
-End Sub\r
-\r
\r