OSDN Git Service

Version 1.00
authorT's-Neko <ts-neko@users.osdn.me>
Wed, 4 Jan 2017 13:08:45 +0000 (22:08 +0900)
committerT's-Neko <ts-neko@users.osdn.me>
Wed, 4 Jan 2017 13:08:45 +0000 (22:08 +0900)
88 files changed:
sample/sample.vbs [new file with mode: 0644]
test/_err2_test/ans1.txt [new file with mode: 0644]
test/_err2_test/c.bat [new file with mode: 0644]
test/_err2_test/d.bat [new file with mode: 0644]
test/_err2_test/test.bat [new file with mode: 0644]
test/_err2_test/x.vbs [new file with mode: 0644]
test/_test_test/ans0.txt [new file with mode: 0644]
test/_test_test/ans1.txt [new file with mode: 0644]
test/_test_test/ans2a.txt [new file with mode: 0644]
test/_test_test/ans2b.txt [new file with mode: 0644]
test/_test_test/ans3a.txt [new file with mode: 0644]
test/_test_test/ans3b.txt [new file with mode: 0644]
test/_test_test/ans4a.txt [new file with mode: 0644]
test/_test_test/ans4b.txt [new file with mode: 0644]
test/_test_test/debug.bat [new file with mode: 0644]
test/_test_test/out0.txt [new file with mode: 0644]
test/_test_test/test.bat [new file with mode: 0644]
test/_test_test/test1/test.vbs [new file with mode: 0644]
test/_test_test/test2/test.vbs [new file with mode: 0644]
test/_test_test/test3/test.vbs [new file with mode: 0644]
test/_test_test/test4/test.vbs [new file with mode: 0644]
test/_test_test/test_test.vbs [new file with mode: 0644]
test/_tmp_test/a/c.bat [new file with mode: 0644]
test/_tmp_test/a/d.bat [new file with mode: 0644]
test/_tmp_test/aa/a/a/c.bat [new file with mode: 0644]
test/_tmp_test/aa/a/a/d.bat [new file with mode: 0644]
test/_tmp_test/aa/a/c.bat [new file with mode: 0644]
test/_tmp_test/aa/a/d.bat [new file with mode: 0644]
test/_tmp_test/aa/test.bat [new file with mode: 0644]
test/_tmp_test/debugger.bat [new file with mode: 0644]
test/_tmp_test/test.bat [new file with mode: 0644]
test/_tmp_test/test.vbs [new file with mode: 0644]
test/array/debugger.bat [new file with mode: 0644]
test/array/test.bat [new file with mode: 0644]
test/array/test.vbs [new file with mode: 0644]
test/call/batch.bat [new file with mode: 0644]
test/call/debugger.bat [new file with mode: 0644]
test/call/load_class/debugger.bat [new file with mode: 0644]
test/call/load_class/myclass.vbs [new file with mode: 0644]
test/call/load_class/test.bat [new file with mode: 0644]
test/call/load_class/test1.vbs [new file with mode: 0644]
test/call/load_class/test2.vbs [new file with mode: 0644]
test/call/return/return.exe [new file with mode: 0644]
test/call/return/src/return.cpp [new file with mode: 0644]
test/call/return/src/return.sln [new file with mode: 0644]
test/call/return/src/return.vcproj [new file with mode: 0644]
test/call/syntaxerr.vbs [new file with mode: 0644]
test/call/test.bat [new file with mode: 0644]
test/call/test.vbs [new file with mode: 0644]
test/copy/_old/locked/test.txt [new file with mode: 0644]
test/copy/_old/notlock/test.txt [new file with mode: 0644]
test/copy/_old/sub/sub.vbs [new file with mode: 0644]
test/copy/_old/sub/sub2.vbs [new file with mode: 0644]
test/copy/data.lzh [new file with mode: 0644]
test/copy/data.zip [new file with mode: 0644]
test/copy/data/src1.txt [new file with mode: 0644]
test/copy/data/src2/src2.txt [new file with mode: 0644]
test/copy/data/src2/sub/src2_sub.txt [new file with mode: 0644]
test/copy/data/src3/src1.txt [new file with mode: 0644]
test/copy/data/src4/src2/src2.txt [new file with mode: 0644]
test/copy/data/src4/src2/sub/src2_sub.txt [new file with mode: 0644]
test/copy/debugger.bat [new file with mode: 0644]
test/copy/test.bat [new file with mode: 0644]
test/copy/test.vbs [new file with mode: 0644]
test/debugger.bat [new file with mode: 0644]
test/devenv/src/Release/BuildLog.htm [new file with mode: 0644]
test/devenv/src/Release/mt.dep [new file with mode: 0644]
test/devenv/src/Release/return.exe [new file with mode: 0644]
test/devenv/src/Release/return.exe.intermediate.manifest [new file with mode: 0644]
test/devenv/src/Release/return.obj [new file with mode: 0644]
test/devenv/src/Release/return.pdb [new file with mode: 0644]
test/devenv/src/Release/vc80.idb [new file with mode: 0644]
test/devenv/src/Release/vc80.pdb [new file with mode: 0644]
test/devenv/src/return.cpp [new file with mode: 0644]
test/devenv/src/return.sln [new file with mode: 0644]
test/devenv/src/return.vcproj [new file with mode: 0644]
test/devenv/test.bat [new file with mode: 0644]
test/devenv/test.vbs [new file with mode: 0644]
test/shell/debugger.bat [new file with mode: 0644]
test/shell/mkfile.vbs [new file with mode: 0644]
test/shell/test.bat [new file with mode: 0644]
test/shell/test.vbs [new file with mode: 0644]
test/shell/trigger.txt [new file with mode: 0644]
test/test.bat [new file with mode: 0644]
test/test.vbs [new file with mode: 0644]
test/vbslib_test.svg [new file with mode: 0644]
vbslib.chm [new file with mode: 0644]
vbslib/vbslib.vbs [new file with mode: 0644]

diff --git a/sample/sample.vbs b/sample/sample.vbs
new file mode 100644 (file)
index 0000000..e46405d
--- /dev/null
@@ -0,0 +1,39 @@
+Option Explicit \r
+'--- start of lib include ------------------------------------------------------\r
+Dim  g_fs, g_f, g_vbslib, vbslib_folder, en, es\r
+If g_vbslib <> True Then\r
+  vbslib_folder = "..\vbslib" '*************\r
+  Set g_fs = CreateObject( "Scripting.FileSystemObject" )\r
+  On Error Resume Next : Set g_f = g_fs.OpenTextFile( vbslib_folder & "\vbslib.vbs" ) : en = Err.Number : On Error GoTo 0\r
+    If en=76 Or en=53 Then WScript.Echo "[ERROR] vbslib \82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81i" & vbslib_folder & "\vbslib.vbs)" : WScript.Quit 1\r
+    If en <> 0 Then Err.Raise en\r
+  On Error Resume Next : Execute g_f.ReadAll() : en = Err.Number : es = Err.Description : On Error GoTo 0\r
+    If en = 1025 Then\r
+      WScript.Echo es & " in " & vbslib_folder & "\vbslib.vbs"\r
+      WScript.CreateObject("WScript.Shell").Run "wscript " & vbslib_folder & "\vbslib.vbs",1,False\r
+      WScript.Quit 1\r
+    End If\r
+    If en <> 0 Then Err.Raise en\r
+  g_f.Close\r
+  g_vbslib = True\r
+  On Error Resume Next\r
+  main  '*************\r
+  en = Err.Number : es = Err.Description : Err.Clear : On Error GoTo 0\r
+  If en <> 0 Then\r
+    echo "ERROR " & en & " " & es & vbCR & vbLF\r
+    WScript.Quit en\r
+  End If\r
+End If\r
+'--- end of lib include --------------------------------------------------------\r
+\r
+\r
+'********************************************************************************\r
+'  <<< [main] >>>\r
+'********************************************************************************\r
+Sub main()\r
+  ChgToCommandPrompt\r
+  echo "Hello vbslib!"\r
+  pause\r
+End Sub\r
+\r
\r
diff --git a/test/_err2_test/ans1.txt b/test/_err2_test/ans1.txt
new file mode 100644 (file)
index 0000000..3101dd2
--- /dev/null
@@ -0,0 +1,14 @@
+SubA\r
+[ERROR] 0x1A8 \83I\83u\83W\83F\83N\83g\82ª\82 \82è\82Ü\82¹\82ñ\81B ErrID=1\r
+SubA\r
+[ERROR] 0x1A8 \83I\83u\83W\83F\83N\83g\82ª\82 \82è\82Ü\82¹\82ñ\81B ErrID=2\r
+SubB\r
+finally1\r
+Resume Next\r
+rollback\r
+finally2\r
+[ERROR] 0x1A8 \83I\83u\83W\83F\83N\83g\82ª\82 \82è\82Ü\82¹\82ñ\81B ErrID=3\r
+SubC1\r
+[ERROR] 0x1A8 \83I\83u\83W\83F\83N\83g\82ª\82 \82è\82Ü\82¹\82ñ\81B ErrID=4\r
+SubC2\r
+[ERROR] 0x80040001 OverRaise ErrID=5\r
diff --git a/test/_err2_test/c.bat b/test/_err2_test/c.bat
new file mode 100644 (file)
index 0000000..6d9987b
--- /dev/null
@@ -0,0 +1,3 @@
+cscript x.vbs\r
+\r
\r
diff --git a/test/_err2_test/d.bat b/test/_err2_test/d.bat
new file mode 100644 (file)
index 0000000..f4bef54
--- /dev/null
@@ -0,0 +1,3 @@
+cscript //x x.vbs\r
+\r
\r
diff --git a/test/_err2_test/test.bat b/test/_err2_test/test.bat
new file mode 100644 (file)
index 0000000..1402076
--- /dev/null
@@ -0,0 +1,10 @@
+@echo off\r
+\r
+cscript //nologo x.vbs > out1.txt\r
+fc out1.txt ans1.txt\r
+if errorlevel 1 echo Test Failed. & pause & goto :eof\r
+del out1.txt\r
+\r
+echo Test Passed ! \r
+echo Check equal to Err2 in x.vbs and in vbslib.vbs\r
+pause
\ No newline at end of file
diff --git a/test/_err2_test/x.vbs b/test/_err2_test/x.vbs
new file mode 100644 (file)
index 0000000..82c62e0
--- /dev/null
@@ -0,0 +1,139 @@
+Dim g_log\r
+\r
+' Start of Err2 ------------------------------------------------------------- \r
+Class Err2\r
+\r
+  Public  num          ' Err.Number\r
+  Public  Description  ' Err.Description (Error Message)\r
+  Public  Source       ' Err.Source\r
+  Public  ErrID        ' count of (num <> 0) in each first Copy after Clear\r
+  Public  RaiseID      ' count of (num <> 0) in Copy\r
+\r
+  Private Sub Class_Initialize\r
+    num = 0 : Description = "" : ErrID = 0 : RaiseID = 0\r
+  End Sub\r
+\r
+  Public Sub Copy( err )\r
+    num = err.Number\r
+    Description = err.Description\r
+    Source = err.Source\r
+    if num <> 0 Then RaiseID = RaiseID + 1 : if RaiseID = 1 Then ErrID = ErrID + 1\r
+\r
+    'If ErrID = 2 Then Stop  ' if debug, Enable this line and "If e.ErrID <> ErrID_of_this-1 Then On Error Resume Next" in caller\r
+\r
+  End Sub\r
+\r
+  Public Sub Echo\r
+    Dim msg\r
+    msg = "[ERROR] 0x" & Hex(num) & " " & Description & " ErrID=" & ErrID\r
+    WScript.Echo msg\r
+    If Not IsEmpty( g_log ) Then  g_log.WriteLine msg\r
+  End Sub\r
+\r
+  Public Sub OverRaise( e_num, e_desc )\r
+    num = vbObjectError + e_num\r
+    Description = e_desc\r
+    Raise\r
+  End Sub\r
+\r
+  Public Sub Raise\r
+    Err.Raise num, Source, Description\r
+  End Sub\r
+\r
+  Public Sub Clear\r
+    num = 0 : Description = "" : RaiseID = 0\r
+  End Sub\r
+End Class\r
+\r
+Dim e\r
+Set e = new Err2\r
+\r
+' End of Err2 -------------------------------------------------------------\r
+\r
+main\r
+\r
+Sub main\r
+  Dim i\r
+\r
+  For i=1 To 2\r
+    On Error Resume Next\r
+      SubA\r
+    e.Copy( Err ) : On Error GoTo 0 : If e.num <> 0 Then\r
+      e.Echo\r
+      e.Clear\r
+    End If\r
+  Next\r
+\r
+  On Error Resume Next\r
+    SubB\r
+  e.Copy( Err ) : On Error GoTo 0 : If e.num <> 0 Then\r
+    e.Echo\r
+    e.Clear\r
+  End If\r
+\r
+  On Error Resume Next\r
+    SubC1\r
+  e.Copy( Err ) : On Error GoTo 0 : If e.num <> 0 Then\r
+    e.Echo\r
+    e.Clear\r
+  End If\r
+\r
+  On Error Resume Next\r
+    SubC2\r
+  e.Copy( Err ) : On Error GoTo 0 : If e.num <> 0 Then\r
+    e.Echo\r
+    e.Clear\r
+  End If\r
+\r
+End Sub\r
+\r
+\r
+Sub SubA\r
+  WScript.Echo "SubA"\r
+  NO_OBJ.ERROR\r
+  WScript.Echo "Not Come Here"\r
+End Sub\r
+\r
+\r
+Sub SubB\r
+  WScript.Echo "SubB"\r
+  On Error Resume Next\r
+  e.Copy( Err ) : On Error GoTo 0 : If e.num <> 0 Then\r
+    WScript.Echo "rollback : Not Come Here"\r
+  End If\r
+    WScript.Echo "finally1"\r
+  If e.num <> 0 Then  e.Raise\r
+\r
+  On Error Resume Next\r
+    NO_OBJ.ERROR\r
+    WScript.Echo "Resume Next"\r
+    If Err=0 Then  WScript.Echo "Not Come Here"\r
+  e.Copy( Err ) : On Error GoTo 0 : If e.num <> 0 Then\r
+    WScript.Echo "rollback"\r
+  End If\r
+    WScript.Echo "finally2"\r
+  If e.num <> 0 Then  e.Raise\r
+End Sub\r
+\r
+\r
+Sub SubC1\r
+  WScript.Echo "SubC1"\r
+  On Error Resume Next\r
+    NO_OBJ.ERROR\r
+  e.Copy( Err ) : On Error GoTo 0 : If e.num <> 0 Then\r
+    if e.num = &h1e0 Then e.OverRaise  1, "OverRaise" Else e.Raise\r
+  End If\r
+End Sub\r
+\r
+\r
+Sub SubC2\r
+  WScript.Echo "SubC2"\r
+  On Error Resume Next\r
+    NO_OBJ.ERROR\r
+  e.Copy( Err ) : On Error GoTo 0 : If e.num <> 0 Then\r
+    if e.num = &h1A8 Then e.OverRaise  1, "OverRaise" Else e.Raise\r
+  End If\r
+End Sub\r
+\r
+\r
\r
diff --git a/test/_test_test/ans0.txt b/test/_test_test/ans0.txt
new file mode 100644 (file)
index 0000000..ccd56f7
--- /dev/null
@@ -0,0 +1,163 @@
+Test Start\r
+==========================================================\r
+Test: test1\test.vbs - test_main \r
+test1\r
+Pass.\r
+==========================================================\r
+Test: test2\test.vbs - test_main \r
+test2\r
+[ERROR] 0x1F4 \82±\82Ì\95Ï\90\94\82Í\90é\8c¾\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B ErrID=1\r
+==========================================================\r
+Test: test3\test.vbs - test_main \r
+test3\r
+[ERROR] 0x80040001 test3 err ErrID=2\r
+==========================================================\r
+Test: test4\test.vbs - test_main \r
+test4\r
+[SKIP] test4 skip\r
+==========================================================\r
+Test: test1\test.vbs - test_main \r
+test1\r
+Pass.\r
+==========================================================\r
+Test: test2\test.vbs - test_main \r
+test2\r
+[ERROR] 0x1F4 \82±\82Ì\95Ï\90\94\82Í\90é\8c¾\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B ErrID=4\r
+==========================================================\r
+Test: test3\test.vbs - test_main \r
+test3\r
+[ERROR] 0x80040001 test3 err ErrID=5\r
+==========================================================\r
+Test: test4\test.vbs - test_main \r
+test4\r
+[SKIP] test4 skip\r
+==========================================================\r
+Test: test1\test.vbs - test_main \r
+test1\r
+Pass.\r
+==========================================================\r
+Test: test2\test.vbs - test_main \r
+test2\r
+[ERROR] 0x1F4 \82±\82Ì\95Ï\90\94\82Í\90é\8c¾\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B ErrID=7\r
+==========================================================\r
+Test: test3\test.vbs - test_main \r
+test3\r
+[ERROR] 0x80040001 test3 err ErrID=8\r
+==========================================================\r
+Test: test4\test.vbs - test_main \r
+test4\r
+[SKIP] test4 skip\r
+==========================================================\r
+Test: test1\test.vbs - test_main \r
+test1\r
+Pass.\r
+==========================================================\r
+Test: test2\test.vbs - test_main \r
+test2\r
+[ERROR] 0x1F4 \82±\82Ì\95Ï\90\94\82Í\90é\8c¾\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B ErrID=10\r
+==========================================================\r
+Test: test3\test.vbs - test_main \r
+test3\r
+[ERROR] 0x80040001 test3 err ErrID=11\r
+==========================================================\r
+Test: test4\test.vbs - test_main \r
+test4\r
+[SKIP] test4 skip\r
+==========================================================\r
+Test: test1\test.vbs - test_main \r
+test1\r
+Pass.\r
+==========================================================\r
+Test: test2\test.vbs - test_main \r
+test2\r
+[ERROR] 0x1F4 \82±\82Ì\95Ï\90\94\82Í\90é\8c¾\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B ErrID=13\r
+==========================================================\r
+Test: test3\test.vbs - test_main \r
+test3\r
+[ERROR] 0x80040001 test3 err ErrID=14\r
+==========================================================\r
+Test: test4\test.vbs - test_main \r
+test4\r
+[SKIP] test4 skip\r
+==========================================================\r
+Test: test1\test.vbs - test_main \r
+test1\r
+Pass.\r
+==========================================================\r
+Test: test2\test.vbs - test_main \r
+test2\r
+[ERROR] 0x1F4 \82±\82Ì\95Ï\90\94\82Í\90é\8c¾\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B ErrID=16\r
+==========================================================\r
+Test: test3\test.vbs - test_main \r
+test3\r
+[ERROR] 0x80040001 test3 err ErrID=17\r
+==========================================================\r
+Test: test4\test.vbs - test_main \r
+test4\r
+[SKIP] test4 skip\r
+==========================================================\r
+Test: test1\test.vbs - test_main \r
+test1\r
+Pass.\r
+==========================================================\r
+Test: test2\test.vbs - test_main \r
+test2\r
+[ERROR] 0x1F4 \82±\82Ì\95Ï\90\94\82Í\90é\8c¾\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B ErrID=19\r
+==========================================================\r
+Test: test3\test.vbs - test_main \r
+test3\r
+[ERROR] 0x80040001 test3 err ErrID=20\r
+==========================================================\r
+Test: test4\test.vbs - test_main \r
+test4\r
+[SKIP] test4 skip\r
+==========================================================\r
+Test: test1\test.vbs - test_main \r
+test1\r
+Pass.\r
+==========================================================\r
+Test: test2\test.vbs - test_main \r
+test2\r
+[ERROR] 0x1F4 \82±\82Ì\95Ï\90\94\82Í\90é\8c¾\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B ErrID=22\r
+==========================================================\r
+Test: test3\test.vbs - test_main \r
+test3\r
+[ERROR] 0x80040001 test3 err ErrID=23\r
+==========================================================\r
+Test: test4\test.vbs - test_main \r
+test4\r
+[SKIP] test4 skip\r
+==========================================================\r
+Test: test1\test.vbs - test_main \r
+test1\r
+Pass.\r
+==========================================================\r
+Test: test2\test.vbs - test_main \r
+test2\r
+[ERROR] 0x1F4 \82±\82Ì\95Ï\90\94\82Í\90é\8c¾\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B ErrID=25\r
+==========================================================\r
+Test: test3\test.vbs - test_main \r
+test3\r
+[ERROR] 0x80040001 test3 err ErrID=26\r
+==========================================================\r
+Test: test4\test.vbs - test_main \r
+test4\r
+[SKIP] test4 skip\r
+==========================================================\r
+Test: test1\test.vbs - test_main \r
+test1\r
+Pass.\r
+==========================================================\r
+Test: test2\test.vbs - test_main \r
+test2\r
+[ERROR] 0x1F4 \82±\82Ì\95Ï\90\94\82Í\90é\8c¾\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B ErrID=28\r
+==========================================================\r
+Test: test3\test.vbs - test_main \r
+test3\r
+[ERROR] 0x80040001 test3 err ErrID=29\r
+==========================================================\r
+Test: test4\test.vbs - test_main \r
+test4\r
+[SKIP] test4 skip\r
+==========================================================\r
+Test Finish (Pass=10, SKIP=10, ERROR=20)\r
diff --git a/test/_test_test/ans1.txt b/test/_test_test/ans1.txt
new file mode 100644 (file)
index 0000000..b892c72
--- /dev/null
@@ -0,0 +1 @@
+test1\r
diff --git a/test/_test_test/ans2a.txt b/test/_test_test/ans2a.txt
new file mode 100644 (file)
index 0000000..ac2a9e0
--- /dev/null
@@ -0,0 +1 @@
+test2\r
diff --git a/test/_test_test/ans2b.txt b/test/_test_test/ans2b.txt
new file mode 100644 (file)
index 0000000..94e0fe7
--- /dev/null
@@ -0,0 +1,2 @@
+C:\Documents and Settings\daily\\83f\83X\83N\83g\83b\83v\vbslib\test\_test_test\test2\test.vbs(29, 3) Microsoft VBScript \8eÀ\8ds\8e\9e\83G\83\89\81[: \82±\82Ì\95Ï\90\94\82Í\90é\8c¾\82³\82ê\82Ä\82¢\82Ü\82¹\82ñ\81B: 'NO_OBJ'\r
+\r
diff --git a/test/_test_test/ans3a.txt b/test/_test_test/ans3a.txt
new file mode 100644 (file)
index 0000000..ae48ec8
--- /dev/null
@@ -0,0 +1 @@
+test3\r
diff --git a/test/_test_test/ans3b.txt b/test/_test_test/ans3b.txt
new file mode 100644 (file)
index 0000000..6c1e62b
--- /dev/null
@@ -0,0 +1,2 @@
+C:\Documents and Settings\daily\\83f\83X\83N\83g\83b\83v\vbslib\test\_test_test\test3\test.vbs(0, 1) VBSLib: test3 err\r
+\r
diff --git a/test/_test_test/ans4a.txt b/test/_test_test/ans4a.txt
new file mode 100644 (file)
index 0000000..72e3ffa
--- /dev/null
@@ -0,0 +1 @@
+test4\r
diff --git a/test/_test_test/ans4b.txt b/test/_test_test/ans4b.txt
new file mode 100644 (file)
index 0000000..d7e24c2
--- /dev/null
@@ -0,0 +1,2 @@
+C:\Documents and Settings\daily\\83f\83X\83N\83g\83b\83v\vbslib\test\_test_test\test4\test.vbs(0, 1) VBSLib: test4 skip\r
+\r
diff --git a/test/_test_test/debug.bat b/test/_test_test/debug.bat
new file mode 100644 (file)
index 0000000..6f01ae5
--- /dev/null
@@ -0,0 +1,3 @@
+cscript //x test_test.vbs\r
+\r
\r
diff --git a/test/_test_test/out0.txt b/test/_test_test/out0.txt
new file mode 100644 (file)
index 0000000..453cee5
--- /dev/null
@@ -0,0 +1 @@
+\93ü\97Í\83G\83\89\81[: \83X\83N\83\8a\83v\83\83t\83@\83C\83\8b "C:\Documents and Settings\daily\\83f\83X\83N\83g\83b\83v\vbslib\test\_test_test\test_test.vbs" \82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81B\r
diff --git a/test/_test_test/test.bat b/test/_test_test/test.bat
new file mode 100644 (file)
index 0000000..378ea9a
--- /dev/null
@@ -0,0 +1,49 @@
+@echo off\r
+\r
+cscript //nologo test_test.vbs > out0.txt\r
+fc out0.txt ans0.txt\r
+if errorlevel 1 echo Test Failed. & pause & goto :eof\r
+fc log.txt ans0.txt\r
+if errorlevel 1 echo Test Failed. & pause & goto :eof\r
+del out0.txt\r
+del log.txt\r
+\r
+pushd test1\r
+cscript //nologo test.vbs > out1.txt\r
+fc out1.txt ..\ans1.txt\r
+if errorlevel 1 popd & echo Test Failed. & pause & goto :eof\r
+del out1.txt\r
+popd\r
+\r
+pushd test2\r
+cscript //nologo test.vbs > out2a.txt 2>out2b.txt\r
+fc out2a.txt ..\ans2a.txt\r
+if errorlevel 1 popd & echo Test Failed. & pause & goto :eof\r
+fc out2b.txt ..\ans2b.txt\r
+if errorlevel 1 popd & echo Test Failed. & pause & goto :eof\r
+del out2a.txt\r
+del out2b.txt\r
+popd\r
+\r
+pushd test3\r
+cscript //nologo test.vbs > out3a.txt 2>out3b.txt\r
+fc out3a.txt ..\ans3a.txt\r
+if errorlevel 1 popd & echo Test Failed. & pause & goto :eof\r
+fc out3b.txt ..\ans3b.txt\r
+if errorlevel 1 popd & echo Test Failed. & pause & goto :eof\r
+del out3a.txt\r
+del out3b.txt\r
+popd\r
+\r
+pushd test4\r
+cscript //nologo test.vbs > out4a.txt 2>out4b.txt\r
+fc out4a.txt ..\ans4a.txt\r
+if errorlevel 1 popd & echo Test Failed. & pause & goto :eof\r
+fc out4b.txt ..\ans4b.txt\r
+if errorlevel 1 popd & echo Test Failed. & pause & goto :eof\r
+del out4a.txt\r
+del out4b.txt\r
+popd\r
+\r
+echo Test Passed ! \r
+pause
\ No newline at end of file
diff --git a/test/_test_test/test1/test.vbs b/test/_test_test/test1/test.vbs
new file mode 100644 (file)
index 0000000..a67e08d
--- /dev/null
@@ -0,0 +1,33 @@
+Option Explicit \r
+'--- start of lib include ------------------------------------------------------\r
+Dim  g_fs, g_f, g_vbslib, vbslib_folder, en, es\r
+if g_vbslib <> True Then\r
+  vbslib_folder = "..\..\..\vbslib" '*************\r
+  Set g_fs = CreateObject( "Scripting.FileSystemObject" )\r
+  On Error Resume Next : Set g_f = g_fs.OpenTextFile( vbslib_folder & "\vbslib.vbs" ) : en = Err.Number : On Error GoTo 0\r
+    If en=76 Or en=53 Then WScript.Echo "[ERROR] vbslib \82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81i" & vbslib_folder & "\vbslib.vbs)" : WScript.Quit 1\r
+    If en <> 0 Then Err.Raise en\r
+  On Error Resume Next : Execute g_f.ReadAll() : en = Err.Number : es = Err.Description : On Error GoTo 0\r
+    If en = 1025 Then\r
+      WScript.Echo es & " in " & vbslib_folder & "\vbslib.vbs"\r
+      WScript.CreateObject("WScript.Shell").Run "wscript " & vbslib_folder & "\vbslib.vbs",1,False\r
+      WScript.Quit 1\r
+    End If\r
+    If en <> 0 Then Err.Raise en\r
+  g_f.Close\r
+  g_vbslib = True\r
+  test_main "" '*************\r
+  echo "pass."\r
+End If\r
+'--- end of lib include --------------------------------------------------------\r
+\r
+\r
+'********************************************************************************\r
+'  <<< [test_main] >>>\r
+'********************************************************************************\r
+Sub test_main( param )\r
+  echo "test1"\r
+End Sub\r
+\r
+\r
\r
diff --git a/test/_test_test/test2/test.vbs b/test/_test_test/test2/test.vbs
new file mode 100644 (file)
index 0000000..320ff36
--- /dev/null
@@ -0,0 +1,34 @@
+Option Explicit \r
+'--- start of lib include ------------------------------------------------------\r
+Dim  g_fs, g_f, g_vbslib, vbslib_folder, en, es\r
+if g_vbslib <> True Then\r
+  vbslib_folder = "..\..\..\vbslib" '*************\r
+  Set g_fs = CreateObject( "Scripting.FileSystemObject" )\r
+  On Error Resume Next : Set g_f = g_fs.OpenTextFile( vbslib_folder & "\vbslib.vbs" ) : en = Err.Number : On Error GoTo 0\r
+    If en=76 Or en=53 Then WScript.Echo "[ERROR] vbslib \82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81i" & vbslib_folder & "\vbslib.vbs)" : WScript.Quit 1\r
+    If en <> 0 Then Err.Raise en\r
+  On Error Resume Next : Execute g_f.ReadAll() : en = Err.Number : es = Err.Description : On Error GoTo 0\r
+    If en = 1025 Then\r
+      WScript.Echo es & " in " & vbslib_folder & "\vbslib.vbs"\r
+      WScript.CreateObject("WScript.Shell").Run "wscript " & vbslib_folder & "\vbslib.vbs",1,False\r
+      WScript.Quit 1\r
+    End If\r
+    If en <> 0 Then Err.Raise en\r
+  g_f.Close\r
+  g_vbslib = True\r
+  test_main "" '*************\r
+  echo "pass."\r
+End If\r
+'--- end of lib include --------------------------------------------------------\r
+\r
\r
+'********************************************************************************\r
+'  <<< [test_main] >>> \r
+'********************************************************************************\r
+Sub test_main( param )\r
+  echo "test2"\r
+  NO_OBJ.ERROR\r
+End Sub\r
+\r
+\r
\r
diff --git a/test/_test_test/test3/test.vbs b/test/_test_test/test3/test.vbs
new file mode 100644 (file)
index 0000000..be302fd
--- /dev/null
@@ -0,0 +1,34 @@
+Option Explicit \r
+'--- start of lib include ------------------------------------------------------\r
+Dim  g_fs, g_f, g_vbslib, vbslib_folder, en, es\r
+if g_vbslib <> True Then\r
+  vbslib_folder = "..\..\..\vbslib" '*************\r
+  Set g_fs = CreateObject( "Scripting.FileSystemObject" )\r
+  On Error Resume Next : Set g_f = g_fs.OpenTextFile( vbslib_folder & "\vbslib.vbs" ) : en = Err.Number : On Error GoTo 0\r
+    If en=76 Or en=53 Then WScript.Echo "[ERROR] vbslib \82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81i" & vbslib_folder & "\vbslib.vbs)" : WScript.Quit 1\r
+    If en <> 0 Then Err.Raise en\r
+  On Error Resume Next : Execute g_f.ReadAll() : en = Err.Number : es = Err.Description : On Error GoTo 0\r
+    If en = 1025 Then\r
+      WScript.Echo es & " in " & vbslib_folder & "\vbslib.vbs"\r
+      WScript.CreateObject("WScript.Shell").Run "wscript " & vbslib_folder & "\vbslib.vbs",1,False\r
+      WScript.Quit 1\r
+    End If\r
+    If en <> 0 Then Err.Raise en\r
+  g_f.Close\r
+  g_vbslib = True\r
+  test_main "" '*************\r
+  echo "pass."\r
+End If\r
+'--- end of lib include --------------------------------------------------------\r
+\r
\r
+'********************************************************************************\r
+'  <<< [test_main] >>> \r
+'********************************************************************************\r
+Sub test_main( param )\r
+  echo "test3"\r
+  raise  1, "test3 err"\r
+End Sub\r
+\r
+\r
\r
diff --git a/test/_test_test/test4/test.vbs b/test/_test_test/test4/test.vbs
new file mode 100644 (file)
index 0000000..191696f
--- /dev/null
@@ -0,0 +1,34 @@
+Option Explicit \r
+'--- start of lib include ------------------------------------------------------\r
+Dim  g_fs, g_f, g_vbslib, vbslib_folder, en, es\r
+if g_vbslib <> True Then\r
+  vbslib_folder = "..\..\..\vbslib" '*************\r
+  Set g_fs = CreateObject( "Scripting.FileSystemObject" )\r
+  On Error Resume Next : Set g_f = g_fs.OpenTextFile( vbslib_folder & "\vbslib.vbs" ) : en = Err.Number : On Error GoTo 0\r
+    If en=76 Or en=53 Then WScript.Echo "[ERROR] vbslib \82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81i" & vbslib_folder & "\vbslib.vbs)" : WScript.Quit 1\r
+    If en <> 0 Then Err.Raise en\r
+  On Error Resume Next : Execute g_f.ReadAll() : en = Err.Number : es = Err.Description : On Error GoTo 0\r
+    If en = 1025 Then\r
+      WScript.Echo es & " in " & vbslib_folder & "\vbslib.vbs"\r
+      WScript.CreateObject("WScript.Shell").Run "wscript " & vbslib_folder & "\vbslib.vbs",1,False\r
+      WScript.Quit 1\r
+    End If\r
+    If en <> 0 Then Err.Raise en\r
+  g_f.Close\r
+  g_vbslib = True\r
+  test_main "" '*************\r
+  echo "pass."\r
+End If\r
+'--- end of lib include --------------------------------------------------------\r
+\r
\r
+'********************************************************************************\r
+'  <<< [test_main] >>> \r
+'********************************************************************************\r
+Sub test_main( param )\r
+  echo "test4"\r
+  Test_skip  "test4 skip"\r
+End Sub\r
+\r
+\r
\r
diff --git a/test/_test_test/test_test.vbs b/test/_test_test/test_test.vbs
new file mode 100644 (file)
index 0000000..de3e329
--- /dev/null
@@ -0,0 +1,45 @@
+Option Explicit \r
+'--- start of lib include ------------------------------------------------------\r
+Dim  g_fs, g_f, g_vbslib, vbslib_folder, en, es\r
+if g_vbslib <> True Then\r
+  vbslib_folder = "..\..\vbslib" '*************\r
+  Set g_fs = CreateObject( "Scripting.FileSystemObject" )\r
+  On Error Resume Next : Set g_f = g_fs.OpenTextFile( vbslib_folder & "\vbslib.vbs" ) : en = Err.Number : On Error GoTo 0\r
+    If en=76 Or en=53 Then WScript.Echo "[ERROR] vbslib \82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81i" & vbslib_folder & "\vbslib.vbs)" : WScript.Quit 1\r
+    If en <> 0 Then Err.Raise en\r
+  On Error Resume Next : Execute g_f.ReadAll() : en = Err.Number : es = Err.Description : On Error GoTo 0\r
+    If en = 1025 Then\r
+      WScript.Echo es & " in " & vbslib_folder & "\vbslib.vbs"\r
+      WScript.CreateObject("WScript.Shell").Run "wscript " & vbslib_folder & "\vbslib.vbs",1,False\r
+      WScript.Quit 1\r
+    End If\r
+    If en <> 0 Then Err.Raise en\r
+  g_f.Close\r
+  g_vbslib = True\r
+  On Error Resume Next\r
+  main  '*************\r
+  en = Err.Number : es = Err.Description : Err.Clear : On Error GoTo 0\r
+  If en <> 0 Then\r
+    echo "ERROR " & en & " " & es & vbCR & vbLF\r
+    WScript.Quit en\r
+  End If\r
+End If\r
+'--- end of lib include --------------------------------------------------------\r
+\r
\r
+Sub main() \r
+  ChgToCommandPrompt\r
+  Test_init\r
+\r
+  Dim  r,i\r
+\r
+  For i=1 To 10\r
+    Test_do  "test1\test.vbs", "test_main", ""\r
+    Test_do  "test2\test.vbs", "test_main", ""\r
+    Test_do  "test3\test.vbs", "test_main", ""\r
+    Test_do  "test4\test.vbs", "test_main", ""\r
+  Next\r
+\r
+  Test_finish\r
+End Sub\r
\r
diff --git a/test/_tmp_test/a/c.bat b/test/_tmp_test/a/c.bat
new file mode 100644 (file)
index 0000000..6d9987b
--- /dev/null
@@ -0,0 +1,3 @@
+cscript x.vbs\r
+\r
\r
diff --git a/test/_tmp_test/a/d.bat b/test/_tmp_test/a/d.bat
new file mode 100644 (file)
index 0000000..f4bef54
--- /dev/null
@@ -0,0 +1,3 @@
+cscript //x x.vbs\r
+\r
\r
diff --git a/test/_tmp_test/aa/a/a/c.bat b/test/_tmp_test/aa/a/a/c.bat
new file mode 100644 (file)
index 0000000..6d9987b
--- /dev/null
@@ -0,0 +1,3 @@
+cscript x.vbs\r
+\r
\r
diff --git a/test/_tmp_test/aa/a/a/d.bat b/test/_tmp_test/aa/a/a/d.bat
new file mode 100644 (file)
index 0000000..f4bef54
--- /dev/null
@@ -0,0 +1,3 @@
+cscript //x x.vbs\r
+\r
\r
diff --git a/test/_tmp_test/aa/a/c.bat b/test/_tmp_test/aa/a/c.bat
new file mode 100644 (file)
index 0000000..6d9987b
--- /dev/null
@@ -0,0 +1,3 @@
+cscript x.vbs\r
+\r
\r
diff --git a/test/_tmp_test/aa/a/d.bat b/test/_tmp_test/aa/a/d.bat
new file mode 100644 (file)
index 0000000..f4bef54
--- /dev/null
@@ -0,0 +1,3 @@
+cscript //x x.vbs\r
+\r
\r
diff --git a/test/_tmp_test/aa/test.bat b/test/_tmp_test/aa/test.bat
new file mode 100644 (file)
index 0000000..855e4ed
--- /dev/null
@@ -0,0 +1,3 @@
+@cscript test.vbs\r
+@pause\r
\r
diff --git a/test/_tmp_test/debugger.bat b/test/_tmp_test/debugger.bat
new file mode 100644 (file)
index 0000000..2ec22f2
--- /dev/null
@@ -0,0 +1,2 @@
+@cscript //x test.vbs\r
+@pause\r
diff --git a/test/_tmp_test/test.bat b/test/_tmp_test/test.bat
new file mode 100644 (file)
index 0000000..a2a6aa0
--- /dev/null
@@ -0,0 +1,4 @@
+@cscript test.vbs\r
+echo %errorlevel%\r
+@pause\r
\r
diff --git a/test/_tmp_test/test.vbs b/test/_tmp_test/test.vbs
new file mode 100644 (file)
index 0000000..b6befd5
--- /dev/null
@@ -0,0 +1 @@
+WScript.Quit 1
\ No newline at end of file
diff --git a/test/array/debugger.bat b/test/array/debugger.bat
new file mode 100644 (file)
index 0000000..2ec22f2
--- /dev/null
@@ -0,0 +1,2 @@
+@cscript //x test.vbs\r
+@pause\r
diff --git a/test/array/test.bat b/test/array/test.bat
new file mode 100644 (file)
index 0000000..855e4ed
--- /dev/null
@@ -0,0 +1,3 @@
+@cscript test.vbs\r
+@pause\r
\r
diff --git a/test/array/test.vbs b/test/array/test.vbs
new file mode 100644 (file)
index 0000000..0e06c1c
--- /dev/null
@@ -0,0 +1,61 @@
+Option Explicit \r
+'--- start of lib include ------------------------------------------------------\r
+Dim  g_fs, g_f, g_vbslib, vbslib_folder, en, es\r
+If g_vbslib <> True Then\r
+  vbslib_folder = "..\..\vbslib" '*************\r
+  Set g_fs = CreateObject( "Scripting.FileSystemObject" )\r
+  On Error Resume Next : Set g_f = g_fs.OpenTextFile( vbslib_folder & "\vbslib.vbs" ) : en = Err.Number : On Error GoTo 0\r
+    If en=76 Or en=53 Then WScript.Echo "[ERROR] vbslib \82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81i" & vbslib_folder & "\vbslib.vbs)" : WScript.Quit 1\r
+    If en <> 0 Then Err.Raise en\r
+  On Error Resume Next : Execute g_f.ReadAll() : en = Err.Number : es = Err.Description : On Error GoTo 0\r
+    If en = 1025 Then\r
+      WScript.Echo es & " in " & vbslib_folder & "\vbslib.vbs"\r
+      WScript.CreateObject("WScript.Shell").Run "wscript " & vbslib_folder & "\vbslib.vbs",1,False\r
+      WScript.Quit 1\r
+    End If\r
+    If en <> 0 Then Err.Raise en\r
+  g_f.Close\r
+  g_vbslib = True\r
+  On Error Resume Next\r
+  main  '*************\r
+  en = Err.Number : es = Err.Description : Err.Clear : On Error GoTo 0\r
+  If en <> 0 Then\r
+    echo "ERROR " & en & " " & es & vbCR & vbLF\r
+    WScript.Quit en\r
+  End If\r
+End If\r
+'--- end of lib include --------------------------------------------------------\r
+\r
+Sub main:ChgToCommandPrompt:Test_init:Test_do "test.vbs","test_main","":Test_finish:End Sub\r
+\r
+'********************************************************************************\r
+'  <<< [test_main] >>>\r
+'********************************************************************************\r
+Sub test_main( param )\r
+\r
+  Dim  a()\r
+\r
+  echo  ""\r
+  echo  "Array_toEmpty"\r
+  Array_toEmpty  a\r
+  Array_echo  a\r
+\r
+  echo  ""\r
+  echo  "Array_push x 2"\r
+  Array_push  a, 145\r
+  Array_push  a, "ADE"\r
+  Array_echo  a\r
+\r
+  echo  ""\r
+  echo  "Array_pop = " & Array_pop( a )\r
+  Array_echo  a\r
+\r
+  echo  ""\r
+  echo  "Array_toEmpty"\r
+  Array_toEmpty  a\r
+  Array_echo  a\r
+\r
+End Sub\r
+\r
+\r
\r
diff --git a/test/call/batch.bat b/test/call/batch.bat
new file mode 100644 (file)
index 0000000..7156331
--- /dev/null
@@ -0,0 +1,3 @@
+echo a > batch_out.txt \r
+\r
\r
diff --git a/test/call/debugger.bat b/test/call/debugger.bat
new file mode 100644 (file)
index 0000000..2ec22f2
--- /dev/null
@@ -0,0 +1,2 @@
+@cscript //x test.vbs\r
+@pause\r
diff --git a/test/call/load_class/debugger.bat b/test/call/load_class/debugger.bat
new file mode 100644 (file)
index 0000000..2ec22f2
--- /dev/null
@@ -0,0 +1,2 @@
+@cscript //x test.vbs\r
+@pause\r
diff --git a/test/call/load_class/myclass.vbs b/test/call/load_class/myclass.vbs
new file mode 100644 (file)
index 0000000..18bf203
--- /dev/null
@@ -0,0 +1,13 @@
+Class MyClass\r
+  Public  s\r
+\r
+  Public Sub echo\r
+    WScript.Echo "MyClass.echo (" & s & ")"\r
+  End Sub\r
+\r
+  Public Sub setA( arg1 )\r
+    s = arg1\r
+  End Sub\r
+End Class\r
+\r
+\r
diff --git a/test/call/load_class/test.bat b/test/call/load_class/test.bat
new file mode 100644 (file)
index 0000000..765f94c
--- /dev/null
@@ -0,0 +1,4 @@
+@cscript test1.vbs\r
+@cscript test2.vbs\r
+@pause\r
\r
diff --git a/test/call/load_class/test1.vbs b/test/call/load_class/test1.vbs
new file mode 100644 (file)
index 0000000..0611cf1
--- /dev/null
@@ -0,0 +1,50 @@
+Option Explicit \r
+'--- start of lib include ------------------------------------------------------\r
+Dim  g_fs, g_f, g_vbslib, vbslib_folder, en, es\r
+if g_vbslib <> True Then\r
+  vbslib_folder = "..\..\..\vbslib" '*************\r
+  Set g_fs = CreateObject( "Scripting.FileSystemObject" )\r
+  On Error Resume Next : Set g_f = g_fs.OpenTextFile( vbslib_folder & "\vbslib.vbs" ) : en = Err.Number : On Error GoTo 0\r
+    If en=76 Or en=53 Then WScript.Echo "[ERROR] vbslib \82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81i" & vbslib_folder & "\vbslib.vbs)" : WScript.Quit 1\r
+    If en <> 0 Then Err.Raise en\r
+  On Error Resume Next : Execute g_f.ReadAll() : en = Err.Number : es = Err.Description : On Error GoTo 0\r
+    If en = 1025 Then\r
+      WScript.Echo es & " in " & vbslib_folder & "\vbslib.vbs"\r
+      WScript.CreateObject("WScript.Shell").Run "wscript " & vbslib_folder & "\vbslib.vbs",1,False\r
+      WScript.Quit 1\r
+    End If\r
+    If en <> 0 Then Err.Raise en\r
+  g_f.Close\r
+  g_vbslib = True\r
+  test_main "" '*************\r
+  echo "pass."\r
+End If\r
+'--- end of lib include --------------------------------------------------------\r
+\r
+\r
+'********************************************************************************\r
+'  <<< [test_main] >>>\r
+'********************************************************************************\r
+Sub test_main( param )\r
+  Dim  obj\r
+\r
+  include "myclass.vbs"\r
+\r
+  If IsObject( param ) Then\r
+    Set obj = param\r
+  Else\r
+    Set obj = New MyClass\r
+    obj.setA  "test1"\r
+  End If\r
+\r
+  sub1  obj\r
+\r
+End Sub\r
+\r
+Sub  sub1( obj )\r
+  echo "test1.vbs#sub1"\r
+  obj.echo\r
+End Sub\r
+\r
+\r
\r
diff --git a/test/call/load_class/test2.vbs b/test/call/load_class/test2.vbs
new file mode 100644 (file)
index 0000000..5db50f4
--- /dev/null
@@ -0,0 +1,46 @@
+Option Explicit \r
+'--- start of lib include ------------------------------------------------------\r
+Dim  g_fs, g_f, g_vbslib, vbslib_folder, en, es\r
+if g_vbslib <> True Then\r
+  vbslib_folder = "..\..\..\vbslib" '*************\r
+  Set g_fs = CreateObject( "Scripting.FileSystemObject" )\r
+  On Error Resume Next : Set g_f = g_fs.OpenTextFile( vbslib_folder & "\vbslib.vbs" ) : en = Err.Number : On Error GoTo 0\r
+    If en=76 Or en=53 Then WScript.Echo "[ERROR] vbslib \82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81i" & vbslib_folder & "\vbslib.vbs)" : WScript.Quit 1\r
+    If en <> 0 Then Err.Raise en\r
+  On Error Resume Next : Execute g_f.ReadAll() : en = Err.Number : es = Err.Description : On Error GoTo 0\r
+    If en = 1025 Then\r
+      WScript.Echo es & " in " & vbslib_folder & "\vbslib.vbs"\r
+      WScript.CreateObject("WScript.Shell").Run "wscript " & vbslib_folder & "\vbslib.vbs",1,False\r
+      WScript.Quit 1\r
+    End If\r
+    If en <> 0 Then Err.Raise en\r
+  g_f.Close\r
+  g_vbslib = True\r
+  test_main "" '*************\r
+  echo "pass."\r
+End If\r
+'--- end of lib include --------------------------------------------------------\r
+\r
+\r
+'********************************************************************************\r
+'  <<< [test_main] >>>\r
+'********************************************************************************\r
+Sub test_main( param )\r
+  Dim  obj\r
+\r
+  include "myclass.vbs"\r
+\r
+  Set obj = New MyClass\r
+  obj.setA  "test2"\r
+  sub1  obj\r
+\r
+  call_vbs  "test1.vbs", "test_main", obj\r
+\r
+End Sub\r
+\r
+Sub  sub1( obj )\r
+  echo "test2.vbs#sub1"\r
+  obj.echo\r
+End Sub\r
+\r
\r
diff --git a/test/call/return/return.exe b/test/call/return/return.exe
new file mode 100644 (file)
index 0000000..a88dcc4
Binary files /dev/null and b/test/call/return/return.exe differ
diff --git a/test/call/return/src/return.cpp b/test/call/return/src/return.cpp
new file mode 100644 (file)
index 0000000..141f064
--- /dev/null
@@ -0,0 +1,9 @@
+#include <tchar.h>\r
+#include <stdlib.h>\r
+\r
+int _tmain(int argc, _TCHAR* argv[])\r
+{\r
+  if ( argc == 1 )  *(char*)0 = 1;  /* exception */\r
+       return  _ttoi( argv[1] );\r
+}\r
+\r
diff --git a/test/call/return/src/return.sln b/test/call/return/src/return.sln
new file mode 100644 (file)
index 0000000..fdb91fc
--- /dev/null
@@ -0,0 +1,20 @@
+\r
+Microsoft Visual Studio Solution File, Format Version 9.00\r
+# Visual Studio 2005\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "return", "return.vcproj", "{DEA0DCC0-A4FF-4028-A1AD-32A70CB796A1}"\r
+EndProject\r
+Global\r
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+               Debug|Win32 = Debug|Win32\r
+               Release|Win32 = Release|Win32\r
+       EndGlobalSection\r
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+               {DEA0DCC0-A4FF-4028-A1AD-32A70CB796A1}.Debug|Win32.ActiveCfg = Debug|Win32\r
+               {DEA0DCC0-A4FF-4028-A1AD-32A70CB796A1}.Debug|Win32.Build.0 = Debug|Win32\r
+               {DEA0DCC0-A4FF-4028-A1AD-32A70CB796A1}.Release|Win32.ActiveCfg = Release|Win32\r
+               {DEA0DCC0-A4FF-4028-A1AD-32A70CB796A1}.Release|Win32.Build.0 = Release|Win32\r
+       EndGlobalSection\r
+       GlobalSection(SolutionProperties) = preSolution\r
+               HideSolutionNode = FALSE\r
+       EndGlobalSection\r
+EndGlobal\r
diff --git a/test/call/return/src/return.vcproj b/test/call/return/src/return.vcproj
new file mode 100644 (file)
index 0000000..e2f155a
--- /dev/null
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="shift_jis"?>\r
+<VisualStudioProject\r
+       ProjectType="Visual C++"\r
+       Version="8.00"\r
+       Name="return"\r
+       ProjectGUID="{DEA0DCC0-A4FF-4028-A1AD-32A70CB796A1}"\r
+       RootNamespace="return"\r
+       Keyword="Win32Proj"\r
+       >\r
+       <Platforms>\r
+               <Platform\r
+                       Name="Win32"\r
+               />\r
+       </Platforms>\r
+       <ToolFiles>\r
+       </ToolFiles>\r
+       <Configurations>\r
+               <Configuration\r
+                       Name="Debug|Win32"\r
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+                       IntermediateDirectory="$(ConfigurationName)"\r
+                       ConfigurationType="1"\r
+                       CharacterSet="1"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"\r
+                               MinimalRebuild="true"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="3"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="4"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               LinkIncremental="2"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="1"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+                       IntermediateDirectory="$(ConfigurationName)"\r
+                       ConfigurationType="1"\r
+                       CharacterSet="1"\r
+                       WholeProgramOptimization="1"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"\r
+                               RuntimeLibrary="0"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="3"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               LinkIncremental="1"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="1"\r
+                               OptimizeReferences="2"\r
+                               EnableCOMDATFolding="2"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+       </Configurations>\r
+       <References>\r
+       </References>\r
+       <Files>\r
+               <Filter\r
+                       Name="\83\\81[\83\83t\83@\83C\83\8b"\r
+                       Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
+                       >\r
+                       <File\r
+                               RelativePath=".\return.cpp"\r
+                               >\r
+                       </File>\r
+               </Filter>\r
+               <Filter\r
+                       Name="\83w\83b\83_\81\83t\83@\83C\83\8b"\r
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
+                       >\r
+               </Filter>\r
+               <Filter\r
+                       Name="\83\8a\83\\81[\83\83t\83@\83C\83\8b"\r
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"\r
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
+                       >\r
+               </Filter>\r
+       </Files>\r
+       <Globals>\r
+       </Globals>\r
+</VisualStudioProject>\r
diff --git a/test/call/syntaxerr.vbs b/test/call/syntaxerr.vbs
new file mode 100644 (file)
index 0000000..95d43db
--- /dev/null
@@ -0,0 +1,9 @@
+'********************************************************************************\r
+'  <<< [test_main] >>>\r
+'********************************************************************************\r
+Sub test_main( param )\r
+  +\r
+End Sub\r
+\r
+\r
\r
diff --git a/test/call/test.bat b/test/call/test.bat
new file mode 100644 (file)
index 0000000..855e4ed
--- /dev/null
@@ -0,0 +1,3 @@
+@cscript test.vbs\r
+@pause\r
\r
diff --git a/test/call/test.vbs b/test/call/test.vbs
new file mode 100644 (file)
index 0000000..8acf329
--- /dev/null
@@ -0,0 +1,86 @@
+Option Explicit \r
+'--- start of lib include ------------------------------------------------------\r
+Dim  g_fs, g_f, g_vbslib, vbslib_folder, en, es\r
+if g_vbslib <> True Then\r
+  vbslib_folder = "..\..\vbslib" '*************\r
+  Set g_fs = CreateObject( "Scripting.FileSystemObject" )\r
+  On Error Resume Next : Set g_f = g_fs.OpenTextFile( vbslib_folder & "\vbslib.vbs" ) : en = Err.Number : On Error GoTo 0\r
+    If en=76 Or en=53 Then WScript.Echo "[ERROR] vbslib \82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81i" & vbslib_folder & "\vbslib.vbs)" : WScript.Quit 1\r
+    If en <> 0 Then Err.Raise en\r
+  On Error Resume Next : Execute g_f.ReadAll() : en = Err.Number : es = Err.Description : On Error GoTo 0\r
+    If en = 1025 Then\r
+      WScript.Echo es & " in " & vbslib_folder & "\vbslib.vbs"\r
+      WScript.CreateObject("WScript.Shell").Run "wscript " & vbslib_folder & "\vbslib.vbs",1,False\r
+      WScript.Quit 1\r
+    End If\r
+    If en <> 0 Then Err.Raise en\r
+  g_f.Close\r
+  g_vbslib = True\r
+  'test_main "1"\r
+  On Error Resume Next\r
+  main  '*************\r
+  en = Err.Number : es = Err.Description : Err.Clear : On Error GoTo 0\r
+  If en <> 0 Then\r
+    echo "ERROR " & en & " " & es & vbCR & vbLF\r
+    WScript.Quit en\r
+  End If\r
+End If\r
+'--- end of lib include --------------------------------------------------------\r
+\r
+\r
+Sub main:ChgToCommandPrompt:Test_init:Test_do "test.vbs","test_main","1":Test_finish:End Sub\r
+\r
+\r
+'********************************************************************************\r
+'  <<< [test_main] >>>\r
+'********************************************************************************\r
+Sub test_main( param )\r
+  Dim  r, f\r
+\r
+  ' Not check return Call\r
+  call_exe """return\return.exe"" 0"\r
+\r
+  ' Call batch file\r
+  echo "Call batch file"\r
+  del "batch_out.txt"\r
+  call_exe "batch.bat"\r
+  chk_exist "batch_out.txt"\r
+  del "batch_out.txt"\r
+\r
+\r
+  ' Check return value (check-1)\r
+  echo "Check return value (check-1)"\r
+  r = call_exe( "return\return.exe 0" )\r
+  If r <> 0 Then  raise  E_TestFail, ""\r
+\r
+  r = call_exe( "return\return.exe 1" )\r
+  If r <> 1 Then  raise  E_TestFail, ""\r
+\r
+\r
+  ' Check vbs file path in syntax error message (check-4)\r
+  echo "Check vbs file path in syntax error message (check-4)"\r
+  On Error Resume Next\r
+    include  "syntaxerr.vbs"\r
+  e.Copy( Err ) : On Error GoTo 0 : If e.num <> 0 Then\r
+    If InStr( e.Description, "syntaxerr.vbs" ) = 0 Then  e.Raise\r
+    e.Clear\r
+  End If\r
+\r
+\r
+  ' Raises exception in Callee program (check-2)\r
+  If param = "1" Then\r
+    echo "Program will terminate by exception..."\r
+\r
+    f = 1\r
+    On Error Resume Next\r
+      r = call_exe( "return\return.exe" )\r
+    e.Copy( Err ) : On Error GoTo 0 : If e.num <> 0 Then\r
+      If e.num <> E_ProgTerminated Then  e.Raise\r
+      f = 0\r
+    End If\r
+     If f <> 0 Then  raise  E_TestFail, ""\r
+  End If\r
+End Sub\r
+\r
+\r
\r
diff --git a/test/copy/_old/locked/test.txt b/test/copy/_old/locked/test.txt
new file mode 100644 (file)
index 0000000..0519ecb
--- /dev/null
@@ -0,0 +1 @@
\ No newline at end of file
diff --git a/test/copy/_old/notlock/test.txt b/test/copy/_old/notlock/test.txt
new file mode 100644 (file)
index 0000000..0519ecb
--- /dev/null
@@ -0,0 +1 @@
\ No newline at end of file
diff --git a/test/copy/_old/sub/sub.vbs b/test/copy/_old/sub/sub.vbs
new file mode 100644 (file)
index 0000000..5a3b934
--- /dev/null
@@ -0,0 +1,13 @@
+vblib_folder = ".." \r
+Set g_fs = CreateObject("Scripting.FileSystemObject")\r
+Set g_f = g_fs.OpenTextFile(vblib_folder+"\vbslib.vbs") : Execute g_f.ReadAll() : g_f.Close\r
+\r
+Sub main2()\r
+\r
+  echo "sub"\r
+\r
+End Sub\r
+\r
+\r
+\r
\r
diff --git a/test/copy/_old/sub/sub2.vbs b/test/copy/_old/sub/sub2.vbs
new file mode 100644 (file)
index 0000000..15945e7
--- /dev/null
@@ -0,0 +1,14 @@
+vblib_folder = ".." \r
+Set g_fs = CreateObject("Scripting.FileSystemObject")\r
+Set g_f = g_fs.OpenTextFile(vblib_folder+"\vbslib.vbs") : Execute g_f.ReadAll() : g_f.Close\r
+\r
+Sub main2()\r
+\r
+  echo "sub2"\r
+\r
+End Sub\r
+\r
+\r
+\r
+\r
\r
diff --git a/test/copy/data.lzh b/test/copy/data.lzh
new file mode 100644 (file)
index 0000000..bb6ec09
Binary files /dev/null and b/test/copy/data.lzh differ
diff --git a/test/copy/data.zip b/test/copy/data.zip
new file mode 100644 (file)
index 0000000..84ac6ad
Binary files /dev/null and b/test/copy/data.zip differ
diff --git a/test/copy/data/src1.txt b/test/copy/data/src1.txt
new file mode 100644 (file)
index 0000000..e831038
--- /dev/null
@@ -0,0 +1 @@
+src
\ No newline at end of file
diff --git a/test/copy/data/src2/src2.txt b/test/copy/data/src2/src2.txt
new file mode 100644 (file)
index 0000000..e831038
--- /dev/null
@@ -0,0 +1 @@
+src
\ No newline at end of file
diff --git a/test/copy/data/src2/sub/src2_sub.txt b/test/copy/data/src2/sub/src2_sub.txt
new file mode 100644 (file)
index 0000000..d4e1c9d
--- /dev/null
@@ -0,0 +1 @@
+src_sub
\ No newline at end of file
diff --git a/test/copy/data/src3/src1.txt b/test/copy/data/src3/src1.txt
new file mode 100644 (file)
index 0000000..e831038
--- /dev/null
@@ -0,0 +1 @@
+src
\ No newline at end of file
diff --git a/test/copy/data/src4/src2/src2.txt b/test/copy/data/src4/src2/src2.txt
new file mode 100644 (file)
index 0000000..e831038
--- /dev/null
@@ -0,0 +1 @@
+src
\ No newline at end of file
diff --git a/test/copy/data/src4/src2/sub/src2_sub.txt b/test/copy/data/src4/src2/sub/src2_sub.txt
new file mode 100644 (file)
index 0000000..d4e1c9d
--- /dev/null
@@ -0,0 +1 @@
+src_sub
\ No newline at end of file
diff --git a/test/copy/debugger.bat b/test/copy/debugger.bat
new file mode 100644 (file)
index 0000000..2ec22f2
--- /dev/null
@@ -0,0 +1,2 @@
+@cscript //x test.vbs\r
+@pause\r
diff --git a/test/copy/test.bat b/test/copy/test.bat
new file mode 100644 (file)
index 0000000..855e4ed
--- /dev/null
@@ -0,0 +1,3 @@
+@cscript test.vbs\r
+@pause\r
\r
diff --git a/test/copy/test.vbs b/test/copy/test.vbs
new file mode 100644 (file)
index 0000000..ad4d575
--- /dev/null
@@ -0,0 +1,250 @@
+Option Explicit \r
+'--- start of lib include ------------------------------------------------------\r
+Dim  g_fs, g_f, g_vbslib, vbslib_folder, en, es\r
+If g_vbslib <> True Then\r
+  vbslib_folder = "..\..\vbslib" '*************\r
+  Set g_fs = CreateObject( "Scripting.FileSystemObject" )\r
+  On Error Resume Next : Set g_f = g_fs.OpenTextFile( vbslib_folder & "\vbslib.vbs" ) : en = Err.Number : On Error GoTo 0\r
+    If en=76 Or en=53 Then WScript.Echo "[ERROR] vbslib \82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81i" & vbslib_folder & "\vbslib.vbs)" : WScript.Quit 1\r
+    If en <> 0 Then Err.Raise en\r
+  On Error Resume Next : Execute g_f.ReadAll() : en = Err.Number : es = Err.Description : On Error GoTo 0\r
+    If en = 1025 Then\r
+      WScript.Echo es & " in " & vbslib_folder & "\vbslib.vbs"\r
+      WScript.CreateObject("WScript.Shell").Run "wscript " & vbslib_folder & "\vbslib.vbs",1,False\r
+      WScript.Quit 1\r
+    End If\r
+    If en <> 0 Then Err.Raise en\r
+  g_f.Close\r
+  g_vbslib = True\r
+  On Error Resume Next\r
+  main  '*************\r
+  en = Err.Number : es = Err.Description : Err.Clear : On Error GoTo 0\r
+  If en <> 0 Then\r
+    echo "ERROR " & en & " " & es & vbCR & vbLF\r
+    WScript.Quit en\r
+  End If\r
+End If\r
+'--- end of lib include --------------------------------------------------------\r
+\r
+\r
+Sub main:ChgToCommandPrompt:Test_init:Test_do "Test_Dup2.vbs","test_main","":Test_finish:End Sub\r
+\r
+'********************************************************************************\r
+'  <<< [test_main] >>>\r
+'********************************************************************************\r
+Sub test_main( param )\r
+\r
+  ' Make working folder\r
+  del "work"\r
+  If exist("work") Then  raise E_TestFail,""\r
+\r
+  mkdir "work"\r
+  chk_exist  "work"\r
+\r
+\r
+  ' Set working folder\r
+  On Error Resume Next\r
+    set_workfolder  "work2"\r
+  e.Copy( Err ) : On Error GoTo 0 : If e.num = 0 Then  raise E_TestFail,""\r
+  If e.num <> E_FileNotExist  Then e.Raise\r
+  e.Clear\r
+\r
+  set_workfolder  "work"\r
+\r
+\r
+  '======================================================\r
+  ' Test of cheking working folder\r
+  echo "Test of cheking working folder"\r
+\r
+  On Error Resume Next\r
+    mkdir "work2"\r
+  e.Copy( Err ) : On Error GoTo 0 : If e.num = 0 Then  raise E_TestFail,""\r
+  If e.num <> E_OutOfWorkFolder  Then e.Raise\r
+  e.Clear\r
+\r
+  On Error Resume Next\r
+    copy "data", "data2"\r
+  e.Copy( Err ) : On Error GoTo 0 : If e.num = 0 Then  raise E_TestFail,""\r
+  If e.num <> E_OutOfWorkFolder  Then e.Raise\r
+  e.Clear\r
+\r
+  On Error Resume Next\r
+    del "work"\r
+  e.Copy( Err ) : On Error GoTo 0 : If e.num = 0 Then  raise E_TestFail,""\r
+  If e.num <> E_OutOfWorkFolder  Then e.Raise\r
+  e.Clear\r
+\r
+\r
+  '======================================================\r
+  ' Test of exist\r
+  echo "Test of exist"\r
+\r
+  If exist( "work\data\text1.txt" ) Then  raise E_TestFail,""\r
+  CreateFile  "work\data\text1.txt", "text1"\r
+  If Not exist( "work\data\text1.txt" ) Then  raise E_TestFail,""\r
+  If Not exist( "work\data\*.txt" ) Then  raise E_TestFail,""\r
+  If Not exist( "work\data\*" ) Then  raise E_TestFail,""\r
+  If exist( "work\data\*.jpg" ) Then  raise E_TestFail,""\r
+  del "work\data"\r
+\r
+\r
+  '======================================================\r
+  ' Test of fc\r
+  echo "Test of fc"\r
+\r
+  CreateFile  "work\data\text1.txt", "text1"\r
+  CreateFile  "work\data\text2.txt", "text2"\r
+  CreateFile  "work\data\text1B.txt", "text1"\r
+  If fc( "work\data\text1.txt", "work\data\text0.txt" ) Then  raise E_TestFail,""\r
+  If fc( "work\data\text1.txt", "work\data\text2.txt" ) Then  raise E_TestFail,""\r
+  If Not fc( "work\data\text1.txt", "work\data\text1B.txt" ) Then  raise E_TestFail,""\r
+  del "work\data"\r
+\r
+  CreateFile  "work\data\text1.txt", "text1"\r
+  CreateFile  "work\data\k\text2.txt", "text2"\r
+  CreateFile  "work\data\k\text1B.txt", "text1"\r
+  CreateFile  "work\data2\text1.txt", "text1"\r
+  CreateFile  "work\data2\k\text2.txt", "text2"\r
+  CreateFile  "work\data2\k\text1B.txt", "text1"\r
+  If Not fc( "work\data", "work\data2" ) Then  raise E_TestFail,""\r
+  CreateFile  "work\data2\k\text1B.txt", "text2"\r
+  If fc( "work\data", "work\data2" ) Then  raise E_TestFail,""\r
+  del "work\data"\r
+  del "work\data2"\r
+\r
+\r
+  '======================================================\r
+  ' Test of copy\r
+  echo "Test of copy"\r
+\r
+  copy "data\src1.txt", "work"\r
+  If Not fc( "data\src1.txt", "work\src1.txt" )  Then  raise E_TestFail,""\r
+  del "work\src1.txt"\r
+\r
+  copy "data\src1.txt", "work\src1.txt"\r
+  If Not fc( "data\src1.txt", "work\src1.txt" )  Then  raise E_TestFail,""\r
+  del "work\src1.txt"\r
+\r
+  copy "data\src1.txt", "work\src2.txt"\r
+  If Not fc( "data\src1.txt", "work\src2.txt" )  Then  raise E_TestFail,""\r
+  del "work\src2.txt"\r
+\r
+  copy "data\src1.txt", "work\k\src2.txt"\r
+  If Not fc( "data\src1.txt", "work\k\src2.txt" )  Then  raise E_TestFail,""\r
+  del "work\k"\r
+\r
+\r
+  copy "data", "work"\r
+  If Not fc( "data", "work\data" )  Then  raise E_TestFail,""\r
+  del "work\data"\r
+\r
+  copy "data", "work\data"\r
+  If Not fc( "data", "work\data\data" )  Then  raise E_TestFail,""\r
+  del "work\data"\r
+\r
+  copy "data", "work\kk"\r
+  If Not fc( "data", "work\kk\data" )  Then  raise E_TestFail,""\r
+  del "work\kk"\r
+\r
+\r
+  copy "data\*", "work\bb" 'not exist bb\r
+  If Not fc( "data", "work\bb" )  Then  raise E_TestFail,""\r
+\r
+  copy "data\*", "work\bb" 'exist bb\r
+  If Not fc( "data", "work\bb" )  Then  raise E_TestFail,""\r
+  del "work\bb"\r
+\r
+\r
+\r
+  '======================================================\r
+  ' Test of move\r
+  echo "Test of move"\r
+\r
+  mkdir  "work\from"\r
+\r
+  copy "data\src1.txt", "work\from"\r
+  move "work\from\src1.txt", "work"\r
+  If exist( "work\from\src1.txt" )  Then  raise E_TestFail,""\r
+  If Not fc( "data\src1.txt", "work\src1.txt" )  Then  raise E_TestFail,""\r
+  del "work\src1.txt"\r
+\r
+  copy "data\src1.txt", "work\from"\r
+  move "work\from\src1.txt", "work\src1.txt"\r
+  If exist( "work\from\src1.txt" )  Then  raise E_TestFail,""\r
+  If Not fc( "data\src1.txt", "work\src1.txt" )  Then  raise E_TestFail,""\r
+  del "work\src1.txt"\r
+\r
+  copy "data\src1.txt", "work\from"\r
+  move "work\from\src1.txt", "work\src2.txt"\r
+  If exist( "work\from\src1.txt" )  Then  raise E_TestFail,""\r
+  If Not fc( "data\src1.txt", "work\src2.txt" )  Then  raise E_TestFail,""\r
+  del "work\src2.txt"\r
+\r
+  copy "data\src1.txt", "work\from"\r
+  move "work\from\src1.txt", "work\k\src2.txt"\r
+  If exist( "work\from\src1.txt" )  Then  raise E_TestFail,""\r
+  If Not fc( "data\src1.txt", "work\k\src2.txt" )  Then  raise E_TestFail,""\r
+  del "work\k"\r
+\r
+\r
+  copy "data", "work\from"\r
+  move "work\from\data", "work"\r
+  If exist( "work\from\data" )  Then  raise E_TestFail,""\r
+  If Not fc( "data", "work\data" )  Then  raise E_TestFail,""\r
+  del "work\data"\r
+\r
+  copy "data", "work\from"\r
+  move "work\from\data", "work\data"\r
+  If exist( "work\from\data" )  Then  raise E_TestFail,""\r
+  If Not fc( "data", "work\data\data" )  Then  raise E_TestFail,""\r
+  del "work\data"\r
+\r
+  copy "data", "work\from"\r
+  move "work\from\data", "work\kk"\r
+  If exist( "work\from\data" )  Then  raise E_TestFail,""\r
+  If Not fc( "data", "work\kk\data" )  Then  raise E_TestFail,""\r
+  del "work\kk"\r
+\r
+\r
+  copy "data", "work\from"\r
+  move "work\from\data\*", "work\bb" 'not exist bb\r
+  If exist( "work\from\data\*" )  Then  raise E_TestFail,""\r
+  If Not fc( "data", "work\bb" )  Then  raise E_TestFail,""\r
+\r
+  copy "data", "work\from"\r
+  On Error Resume Next\r
+    move "work\from\data\*", "work\bb" 'exist bb\r
+  e.Copy( Err ) : On Error GoTo 0 : If e.num <> 0 Then\r
+    If e.num <> 58 Then  e.Raise\r
+    e.Clear\r
+  End If\r
+\r
+  del "work\bb"\r
+\r
+  del "work\from"\r
+\r
+\r
+  '======================================================\r
+  ' Test of del\r
+  echo "Test of del"\r
+  Dim  fo\r
+\r
+  copy "data", "work"\r
+  del "work\data\*"\r
+\r
+  Set fo = g_fs.GetFolder( "work\data" )\r
+  If fo.Files.Count <> 0 Then  raise E_TestFail,""\r
+  If fo.SubFolders.Count <> 0 Then  raise E_TestFail,""\r
+  del "work\data"\r
+\r
+\r
+  '======================================================\r
+  ' finish\r
+  set_workfolder  "."\r
+\r
+  del "work"\r
+  If exist("work") Then  raise E_TestFail,""\r
+End Sub\r
+\r
+\r
\r
diff --git a/test/debugger.bat b/test/debugger.bat
new file mode 100644 (file)
index 0000000..2ec22f2
--- /dev/null
@@ -0,0 +1,2 @@
+@cscript //x test.vbs\r
+@pause\r
diff --git a/test/devenv/src/Release/BuildLog.htm b/test/devenv/src/Release/BuildLog.htm
new file mode 100644 (file)
index 0000000..302f114
Binary files /dev/null and b/test/devenv/src/Release/BuildLog.htm differ
diff --git a/test/devenv/src/Release/mt.dep b/test/devenv/src/Release/mt.dep
new file mode 100644 (file)
index 0000000..73e845e
--- /dev/null
@@ -0,0 +1 @@
+Manifest resource last updated at 13:06:24.55 on 2007/09/11 \r
diff --git a/test/devenv/src/Release/return.exe b/test/devenv/src/Release/return.exe
new file mode 100644 (file)
index 0000000..0574eeb
Binary files /dev/null and b/test/devenv/src/Release/return.exe differ
diff --git a/test/devenv/src/Release/return.exe.intermediate.manifest b/test/devenv/src/Release/return.exe.intermediate.manifest
new file mode 100644 (file)
index 0000000..324c707
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\r
+<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>\r
+  <dependency>\r
+    <dependentAssembly>\r
+      <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50727.762' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />\r
+    </dependentAssembly>\r
+  </dependency>\r
+</assembly>\r
diff --git a/test/devenv/src/Release/return.obj b/test/devenv/src/Release/return.obj
new file mode 100644 (file)
index 0000000..3ee1735
Binary files /dev/null and b/test/devenv/src/Release/return.obj differ
diff --git a/test/devenv/src/Release/return.pdb b/test/devenv/src/Release/return.pdb
new file mode 100644 (file)
index 0000000..f2705e5
Binary files /dev/null and b/test/devenv/src/Release/return.pdb differ
diff --git a/test/devenv/src/Release/vc80.idb b/test/devenv/src/Release/vc80.idb
new file mode 100644 (file)
index 0000000..4cf1bc1
Binary files /dev/null and b/test/devenv/src/Release/vc80.idb differ
diff --git a/test/devenv/src/Release/vc80.pdb b/test/devenv/src/Release/vc80.pdb
new file mode 100644 (file)
index 0000000..6f07c3d
Binary files /dev/null and b/test/devenv/src/Release/vc80.pdb differ
diff --git a/test/devenv/src/return.cpp b/test/devenv/src/return.cpp
new file mode 100644 (file)
index 0000000..ff29382
--- /dev/null
@@ -0,0 +1,10 @@
+#include <tchar.h> \r
+#include <stdlib.h>\r
+\r
+int _tmain(int argc, _TCHAR* argv[])\r
+{\r
+  if ( argc == 1 )  *(char*)0 = 1;  /* exception */\r
+       return  _ttoi( argv[1] );\r
+}\r
+\r
\r
diff --git a/test/devenv/src/return.sln b/test/devenv/src/return.sln
new file mode 100644 (file)
index 0000000..fdb91fc
--- /dev/null
@@ -0,0 +1,20 @@
+\r
+Microsoft Visual Studio Solution File, Format Version 9.00\r
+# Visual Studio 2005\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "return", "return.vcproj", "{DEA0DCC0-A4FF-4028-A1AD-32A70CB796A1}"\r
+EndProject\r
+Global\r
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+               Debug|Win32 = Debug|Win32\r
+               Release|Win32 = Release|Win32\r
+       EndGlobalSection\r
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+               {DEA0DCC0-A4FF-4028-A1AD-32A70CB796A1}.Debug|Win32.ActiveCfg = Debug|Win32\r
+               {DEA0DCC0-A4FF-4028-A1AD-32A70CB796A1}.Debug|Win32.Build.0 = Debug|Win32\r
+               {DEA0DCC0-A4FF-4028-A1AD-32A70CB796A1}.Release|Win32.ActiveCfg = Release|Win32\r
+               {DEA0DCC0-A4FF-4028-A1AD-32A70CB796A1}.Release|Win32.Build.0 = Release|Win32\r
+       EndGlobalSection\r
+       GlobalSection(SolutionProperties) = preSolution\r
+               HideSolutionNode = FALSE\r
+       EndGlobalSection\r
+EndGlobal\r
diff --git a/test/devenv/src/return.vcproj b/test/devenv/src/return.vcproj
new file mode 100644 (file)
index 0000000..641f5f2
--- /dev/null
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="shift_jis"?>\r
+<VisualStudioProject\r
+       ProjectType="Visual C++"\r
+       Version="8.00"\r
+       Name="return"\r
+       ProjectGUID="{DEA0DCC0-A4FF-4028-A1AD-32A70CB796A1}"\r
+       RootNamespace="return"\r
+       Keyword="Win32Proj"\r
+       >\r
+       <Platforms>\r
+               <Platform\r
+                       Name="Win32"\r
+               />\r
+       </Platforms>\r
+       <ToolFiles>\r
+       </ToolFiles>\r
+       <Configurations>\r
+               <Configuration\r
+                       Name="Debug|Win32"\r
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+                       IntermediateDirectory="$(ConfigurationName)"\r
+                       ConfigurationType="1"\r
+                       CharacterSet="1"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"\r
+                               MinimalRebuild="true"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="3"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="4"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               LinkIncremental="2"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="1"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+                       IntermediateDirectory="$(ConfigurationName)"\r
+                       ConfigurationType="1"\r
+                       CharacterSet="1"\r
+                       WholeProgramOptimization="1"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"\r
+                               RuntimeLibrary="2"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="3"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               LinkIncremental="1"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="1"\r
+                               OptimizeReferences="2"\r
+                               EnableCOMDATFolding="2"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+       </Configurations>\r
+       <References>\r
+       </References>\r
+       <Files>\r
+               <Filter\r
+                       Name="\83\\81[\83\83t\83@\83C\83\8b"\r
+                       Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
+                       >\r
+                       <File\r
+                               RelativePath=".\return.cpp"\r
+                               >\r
+                       </File>\r
+               </Filter>\r
+               <Filter\r
+                       Name="\83w\83b\83_\81\83t\83@\83C\83\8b"\r
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
+                       >\r
+               </Filter>\r
+               <Filter\r
+                       Name="\83\8a\83\\81[\83\83t\83@\83C\83\8b"\r
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"\r
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
+                       >\r
+               </Filter>\r
+       </Files>\r
+       <Globals>\r
+       </Globals>\r
+</VisualStudioProject>\r
diff --git a/test/devenv/test.bat b/test/devenv/test.bat
new file mode 100644 (file)
index 0000000..855e4ed
--- /dev/null
@@ -0,0 +1,3 @@
+@cscript test.vbs\r
+@pause\r
\r
diff --git a/test/devenv/test.vbs b/test/devenv/test.vbs
new file mode 100644 (file)
index 0000000..979e920
--- /dev/null
@@ -0,0 +1,42 @@
+Option Explicit \r
+'--- start of lib include ------------------------------------------------------\r
+Dim  g_fs, g_f, g_vbslib, vbslib_folder, en, es\r
+If g_vbslib <> True Then\r
+  vbslib_folder = "..\..\vbslib" '*************\r
+  Set g_fs = CreateObject( "Scripting.FileSystemObject" )\r
+  On Error Resume Next : Set g_f = g_fs.OpenTextFile( vbslib_folder & "\vbslib.vbs" ) : en = Err.Number : On Error GoTo 0\r
+    If en=76 Or en=53 Then WScript.Echo "[ERROR] vbslib \82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81i" & vbslib_folder & "\vbslib.vbs)" : WScript.Quit 1\r
+    If en <> 0 Then Err.Raise en\r
+  On Error Resume Next : Execute g_f.ReadAll() : en = Err.Number : es = Err.Description : On Error GoTo 0\r
+    If en = 1025 Then\r
+      WScript.Echo es & " in " & vbslib_folder & "\vbslib.vbs"\r
+      WScript.CreateObject("WScript.Shell").Run "wscript " & vbslib_folder & "\vbslib.vbs",1,False\r
+      WScript.Quit 1\r
+    End If\r
+    If en <> 0 Then Err.Raise en\r
+  g_f.Close\r
+  g_vbslib = True\r
+  On Error Resume Next\r
+  main  '*************\r
+  en = Err.Number : es = Err.Description : Err.Clear : On Error GoTo 0\r
+  If en <> 0 Then\r
+    echo "ERROR " & en & " " & es & vbCR & vbLF\r
+    WScript.Quit en\r
+  End If\r
+End If\r
+'--- end of lib include --------------------------------------------------------\r
+\r
+Sub main:ChgToCommandPrompt:Test_init:Test_do "Test_Dup2.vbs","test_main","":Test_finish:End Sub\r
+\r
+\r
+'********************************************************************************\r
+'  <<< [test_main] >>>\r
+'********************************************************************************\r
+Sub test_main( param )\r
+  pushd "src"\r
+  devenv "return.sln /rebuild", "Release"\r
+  popd\r
+End Sub\r
+\r
+\r
\r
diff --git a/test/shell/debugger.bat b/test/shell/debugger.bat
new file mode 100644 (file)
index 0000000..2ec22f2
--- /dev/null
@@ -0,0 +1,2 @@
+@cscript //x test.vbs\r
+@pause\r
diff --git a/test/shell/mkfile.vbs b/test/shell/mkfile.vbs
new file mode 100644 (file)
index 0000000..ecbb6de
--- /dev/null
@@ -0,0 +1,30 @@
+Option Explicit\r
+'--- start of lib include ------------------------------------------------------\r
+Dim  g_fs, g_f, g_vbslib, vbslib_folder, en, es\r
+if g_vbslib <> True Then\r
+  vbslib_folder = "..\..\vbslib" '*************\r
+  Set g_fs = CreateObject( "Scripting.FileSystemObject" )\r
+  On Error Resume Next : Set g_f = g_fs.OpenTextFile( vbslib_folder & "\vbslib.vbs" ) : en = Err.Number : On Error GoTo 0\r
+    If en=76 Or en=53 Then WScript.Echo "[ERROR] vbslib \82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81i" & vbslib_folder & "\vbslib.vbs)" : WScript.Quit 1\r
+    If en <> 0 Then Err.Raise en\r
+  On Error Resume Next : Execute g_f.ReadAll() : en = Err.Number : es = Err.Description : On Error GoTo 0\r
+    If en = 1025 Then\r
+      WScript.Echo es & " in " & vbslib_folder & "\vbslib.vbs"\r
+      WScript.CreateObject("WScript.Shell").Run "wscript " & vbslib_folder & "\vbslib.vbs",1,False\r
+      WScript.Quit 1\r
+    End If\r
+    If en <> 0 Then Err.Raise en\r
+  g_f.Close\r
+  g_vbslib = True\r
+  test_main "" '*************\r
+  echo "pass."\r
+End If\r
+'--- end of lib include --------------------------------------------------------\r
+\r
+\r
+'********************************************************************************\r
+'  <<< [test_main] >>>\r
+'********************************************************************************\r
+Sub test_main( param )\r
+  CreateFile "trigger.txt", ""\r
+End Sub
\ No newline at end of file
diff --git a/test/shell/test.bat b/test/shell/test.bat
new file mode 100644 (file)
index 0000000..855e4ed
--- /dev/null
@@ -0,0 +1,3 @@
+@cscript test.vbs\r
+@pause\r
\r
diff --git a/test/shell/test.vbs b/test/shell/test.vbs
new file mode 100644 (file)
index 0000000..6d01746
--- /dev/null
@@ -0,0 +1,51 @@
+Option Explicit \r
+'--- start of lib include ------------------------------------------------------\r
+Dim  g_fs, g_f, g_vbslib, vbslib_folder, en, es\r
+If g_vbslib <> True Then\r
+  vbslib_folder = "..\..\vbslib" '*************\r
+  Set g_fs = CreateObject( "Scripting.FileSystemObject" )\r
+  On Error Resume Next : Set g_f = g_fs.OpenTextFile( vbslib_folder & "\vbslib.vbs" ) : en = Err.Number : On Error GoTo 0\r
+    If en=76 Or en=53 Then WScript.Echo "[ERROR] vbslib \82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81i" & vbslib_folder & "\vbslib.vbs)" : WScript.Quit 1\r
+    If en <> 0 Then Err.Raise en\r
+  On Error Resume Next : Execute g_f.ReadAll() : en = Err.Number : es = Err.Description : On Error GoTo 0\r
+    If en = 1025 Then\r
+      WScript.Echo es & " in " & vbslib_folder & "\vbslib.vbs"\r
+      WScript.CreateObject("WScript.Shell").Run "wscript " & vbslib_folder & "\vbslib.vbs",1,False\r
+      WScript.Quit 1\r
+    End If\r
+    If en <> 0 Then Err.Raise en\r
+  g_f.Close\r
+  g_vbslib = True\r
+  On Error Resume Next\r
+  main  '*************\r
+  en = Err.Number : es = Err.Description : Err.Clear : On Error GoTo 0\r
+  If en <> 0 Then\r
+    echo "ERROR " & en & " " & es & vbCR & vbLF\r
+    WScript.Quit en\r
+  End If\r
+End If\r
+'--- end of lib include --------------------------------------------------------\r
+\r
+\r
+Sub main:ChgToCommandPrompt:Test_init:Test_do "Test_Dup2.vbs","test_main","":Test_finish:End Sub\r
+\r
+\r
+'********************************************************************************\r
+'  <<< [test_main] >>>\r
+'********************************************************************************\r
+Sub test_main( param )\r
+  test_file_event\r
+End Sub\r
+\r
+\r
+'********************************************************************************\r
+'  <<< [test_file_event] >>>\r
+'********************************************************************************\r
+Sub test_file_event()\r
+  del "trigger.txt"\r
+  start "cscript.exe mkfile.vbs"\r
+  WaitForFile "trigger.txt"\r
+End Sub\r
+\r
+\r
\r
diff --git a/test/shell/trigger.txt b/test/shell/trigger.txt
new file mode 100644 (file)
index 0000000..d3f5a12
--- /dev/null
@@ -0,0 +1 @@
+\r
diff --git a/test/test.bat b/test/test.bat
new file mode 100644 (file)
index 0000000..8cf2636
--- /dev/null
@@ -0,0 +1,17 @@
+@set err_count=0\r
+\r
+@REM (check-3)\r
+@pushd call\load_class\r
+@cscript test1.vbs\r
+@if errorlevel 1  set /A err_count=%err_count%+1\r
+@cscript test2.vbs\r
+@if errorlevel 1  set /A err_count=%err_count%+1\r
+@popd\r
+\r
+@cscript test.vbs\r
+@if errorlevel 1  set /A err_count=%err_count%+1\r
+\r
+@echo Batch ERROR=%err_count%\r
+@set err_count=\r
+@pause\r
\r
diff --git a/test/test.vbs b/test/test.vbs
new file mode 100644 (file)
index 0000000..4ea358d
--- /dev/null
@@ -0,0 +1,42 @@
+Option Explicit \r
+'--- start of lib include ------------------------------------------------------\r
+Dim  g_fs, g_f, g_vbslib, vbslib_folder, en, es\r
+If g_vbslib <> True Then\r
+  vbslib_folder = "..\vbslib" '*************\r
+  Set g_fs = CreateObject( "Scripting.FileSystemObject" )\r
+  On Error Resume Next : Set g_f = g_fs.OpenTextFile( vbslib_folder & "\vbslib.vbs" ) : en = Err.Number : On Error GoTo 0\r
+    If en=76 Or en=53 Then WScript.Echo "[ERROR] vbslib \82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\81i" & vbslib_folder & "\vbslib.vbs)" : WScript.Quit 1\r
+    If en <> 0 Then Err.Raise en\r
+  On Error Resume Next : Execute g_f.ReadAll() : en = Err.Number : es = Err.Description : On Error GoTo 0\r
+    If en = 1025 Then\r
+      WScript.Echo es & " in " & vbslib_folder & "\vbslib.vbs"\r
+      WScript.CreateObject("WScript.Shell").Run "wscript " & vbslib_folder & "\vbslib.vbs",1,False\r
+      WScript.Quit 1\r
+    End If\r
+    If en <> 0 Then Err.Raise en\r
+  g_f.Close\r
+  g_vbslib = True\r
+  On Error Resume Next\r
+  main  '*************\r
+  en = Err.Number : es = Err.Description : Err.Clear : On Error GoTo 0\r
+  If en <> 0 Then\r
+    echo "ERROR " & en & " " & es & vbCR & vbLF\r
+    WScript.Quit en\r
+  End If\r
+End If\r
+'--- end of lib include --------------------------------------------------------\r
+\r
+\r
+'********************************************************************************\r
+'  <<< [main] >>>\r
+'********************************************************************************\r
+Sub main()\r
+  ChgToCommandPrompt\r
+  Test_init\r
+  Test_do  "call\test.vbs", "test_main", ""\r
+  Test_do  "copy\test.vbs", "test_main", ""\r
+  Test_finish\r
+  echo "pass."\r
+End Sub\r
+\r
\r
diff --git a/test/vbslib_test.svg b/test/vbslib_test.svg
new file mode 100644 (file)
index 0000000..faa622d
Binary files /dev/null and b/test/vbslib_test.svg differ
diff --git a/vbslib.chm b/vbslib.chm
new file mode 100644 (file)
index 0000000..45ace8d
Binary files /dev/null and b/vbslib.chm differ
diff --git a/vbslib/vbslib.vbs b/vbslib/vbslib.vbs
new file mode 100644 (file)
index 0000000..97caf3a
--- /dev/null
@@ -0,0 +1,1171 @@
+Option Explicit \r
+\r
+' vbslib  ver1.00 2008/2/11\r
+' Copyright (c) 2008, T's-Neko\r
+' All rights reserved. 3-clause BSD license.\r
+\r
+Dim g_fs, g_log, e, g_workfolder\r
+\r
+Set g_fs = CreateObject("Scripting.FileSystemObject")\r
+Set e = new Err2\r
+g_workfolder = ""\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< Error Code >>> \r
+'********************************************************************************\r
+\r
+'         vbObjectError = &h80040000\r
+Const E_AssertFail      = &h80041001\r
+Const E_FileNotExist    = 2\r
+Const E_TestFail        = &h80041003\r
+Const E_BuildFail       = &h80041004\r
+Const E_OutOfWorkFolder = &h80041005\r
+Const E_ProgTerminated  = &hC0000005\r
+Const E_NotFoundSymbol  = &h80041006\r
+Const E_ProgRetNotZero  = &h80041007\r
\r
+'********************************************************************************\r
+'  <<< File Object >>> \r
+'********************************************************************************\r
+\r
+Const ReadOnly  = 1\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [ChgToCommandPrompt] If VBS file was double clicked, Run a command prompt >>> \r
+'********************************************************************************\r
+Sub ChgToCommandPrompt\r
+  If LCase( Right( WScript.FullName, 11 ) ) = "wscript.exe" Then\r
+    Dim cmd\r
+    cmd = "cscript.exe " & Chr(34) & WScript.ScriptFullName & Chr(34)\r
+    WScript.Quit CreateObject("WScript.Shell").Run( cmd, 1, True )\r
+  End If\r
+End Sub\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [input] >>> \r
+'********************************************************************************\r
+Function  input( ByVal msg )\r
+  Dim e\r
+\r
+  Wscript.StdOut.Write  msg\r
+\r
+  On Error Resume Next\r
+\r
+  input = Wscript.StdIn.ReadLine\r
+\r
+  e = Err.Number : Err.Clear : On Error GoTo 0\r
+  If e <> 0 Then\r
+    If e <> 62 Then Err.Raise e  '62= End Of File (StdIn, ^C)\r
+    WScript.Quit 1\r
+  End If\r
+\r
+End Function\r
+\r
\r
+'********************************************************************************\r
+'  <<< [pause] >>> \r
+'********************************************************************************\r
+Sub  pause()\r
+  input "\91±\8ds\82·\82é\82É\82Í Enter \83L\81[\82ð\89\9f\82µ\82Ä\82­\82¾\82³\82¢ . . ."\r
+End Sub\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [echo] >>> \r
+'********************************************************************************\r
+Sub  echo( ByVal msg )\r
+  WScript.Echo msg\r
+  If Not IsEmpty( g_log ) Then  g_log.WriteLine msg\r
+End Sub\r
+\r
\r
+'********************************************************************************\r
+'  <<< [cd] change current directory >>> \r
+' sample\r
+'   cd "sub"\r
+'********************************************************************************\r
+Sub  cd( ByVal dir )\r
+  Dim  sh\r
+\r
+  Set sh = WScript.CreateObject("WScript.Shell")\r
+  sh.CurrentDirectory = dir\r
+\r
+End Sub\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [pushd] push and change current directory >>> \r
+' sample\r
+'   pushd "sub"\r
+'********************************************************************************\r
+Dim  g_pushd_stack()\r
+Dim  g_pushd_stack_n\r
+\r
+Sub  pushd( ByVal dir )\r
+  Dim  sh\r
+\r
+  g_pushd_stack_n = g_pushd_stack_n + 1\r
+  Redim Preserve  g_pushd_stack( g_pushd_stack_n )\r
+\r
+  Set sh = WScript.CreateObject("WScript.Shell")\r
+  g_pushd_stack( g_pushd_stack_n ) = sh.CurrentDirectory\r
+  sh.CurrentDirectory = dir\r
+\r
+End Sub\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [popd] pop current directory >>> \r
+'********************************************************************************\r
+Sub  popd\r
+  Dim  sh\r
+\r
+  If g_pushd_stack_n < 1 Then Exit Sub\r
+\r
+  Set sh = WScript.CreateObject("WScript.Shell")\r
+  sh.CurrentDirectory = g_pushd_stack( g_pushd_stack_n )\r
+\r
+  g_pushd_stack_n = g_pushd_stack_n - 1\r
+\r
+End Sub\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [set_workfolder] Set modifiable base folder path >>> \r
+' comment\r
+'  - if work path set current directory, path = ""\r
+'********************************************************************************\r
+Sub  set_workfolder( ByVal path )\r
+  If path = "" Then\r
+    g_workfolder = ""\r
+  Else\r
+    chk_exist  path\r
+    g_workfolder = g_fs.GetAbsolutePathName( path )\r
+  End If\r
+End Sub\r
+\r
\r
+'********************************************************************************\r
+'  <<< [copy] >>> \r
+' argument\r
+'  - src : source file or folder path or wild card\r
+'  - dst : destination folder path or renaming file path\r
+' comment\r
+'  - reference: vbslib.svg#copy\r
+'********************************************************************************\r
+Sub  copy( ByVal src, ByVal dst )\r
+\r
+  If g_fs.FolderExists( dst ) Then\r
+    chk_in_workfolder  g_fs.BuildPath( dst, "a" )\r
+  Else\r
+    chk_in_workfolder  dst\r
+  End If\r
+\r
+\r
+  ' If src had Wild card\r
+  If IsWildcard( src ) Then\r
+\r
+    Dim  fo\r
+\r
+    If Not g_fs.FolderExists( dst ) Then  mkdir dst\r
+\r
+    g_fs.CopyFile  src, dst, True\r
+    g_fs.CopyFolder  src, dst, True\r
+\r
+\r
+  ' If src is file\r
+  ElseIf g_fs.FileExists( src ) Then\r
+\r
+    Dim  dst_fo\r
+\r
+    If g_fs.FolderExists( dst ) Then\r
+      dst = g_fs.BuildPath( dst, g_fs.GetFileName( src ) )\r
+    Else\r
+      dst_fo = g_fs.GetParentFolderName( dst )\r
+      If Not g_fs.FolderExists( dst_fo ) Then  mkdir  dst_fo\r
+    End If\r
+\r
+    g_fs.CopyFile  src, dst, True\r
+\r
+\r
+  ' If src is folder\r
+  ElseIf g_fs.FolderExists( src ) Then\r
+\r
+    If Not g_fs.FolderExists( dst ) Then  mkdir  dst\r
+\r
+    g_fs.CopyFolder src, g_fs.BuildPath( dst, g_fs.GetFileName( src ) ), True\r
+\r
+\r
+  ' not found\r
+  Else\r
+    g_fs.CopyFile  src, dst, True  ' Error occurs\r
+\r
+  End If\r
+End Sub\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [move] >>> \r
+'********************************************************************************\r
+Sub  move( ByVal src, ByVal dst )\r
+\r
+  If g_fs.FolderExists( dst ) Then\r
+    chk_in_workfolder  g_fs.BuildPath( dst, "a" )\r
+  Else\r
+    chk_in_workfolder  dst\r
+  End If\r
+\r
+\r
+  ' If src had Wild card\r
+  If IsWildcard( src ) Then\r
+\r
+    Dim  fo\r
+\r
+    If Not g_fs.FolderExists( dst ) Then  mkdir dst\r
+\r
+    g_fs.MoveFile  src, dst\r
+    g_fs.MoveFolder  src, dst\r
+\r
+\r
+  ' If src is file\r
+  ElseIf g_fs.FileExists( src ) Then\r
+\r
+    Dim  dst_fo\r
+\r
+    If g_fs.FolderExists( dst ) Then\r
+      dst = g_fs.BuildPath( dst, g_fs.GetFileName( src ) )\r
+    Else\r
+      dst_fo = g_fs.GetParentFolderName( dst )\r
+      If Not g_fs.FolderExists( dst_fo ) Then  mkdir  dst_fo\r
+    End If\r
+\r
+    g_fs.MoveFile  src, dst\r
+\r
+\r
+  ' If src is folder\r
+  ElseIf g_fs.FolderExists( src ) Then\r
+\r
+    If Not g_fs.FolderExists( dst ) Then  mkdir  dst\r
+\r
+    g_fs.MoveFolder src, g_fs.BuildPath( dst, g_fs.GetFileName( src ) )\r
+\r
+\r
+  ' not found\r
+  Else\r
+    g_fs.MoveFile  src, dst  ' Error occurs\r
+\r
+  End If\r
+End Sub\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [exist] >>> \r
+'********************************************************************************\r
+Function  exist( ByVal path )\r
+  If IsWildcard( path ) Then\r
+    Dim  folder, fnames()\r
+    ExpandWildcard  folder, fnames, path\r
+    exist = Array_count( fnames ) <> 0\r
+  Else\r
+    exist = ( g_fs.FileExists( path ) = True ) Or ( g_fs.FolderExists( path ) = True )\r
+  End If\r
+End Function\r
\r
+'********************************************************************************\r
+'  <<< [chk_exist] >>> \r
+'********************************************************************************\r
+Sub  chk_exist( ByVal path )\r
+  If Not exist( path ) Then  raise E_FileNotExist, path & " not found"\r
+End Sub\r
\r
+'********************************************************************************\r
+'  <<< [chk_in_workfolder] Check not to modify out of working folder >>> \r
+' comment\r
+'  - If path is out of workfolder, raise error of E_OutOfWorkFolder.\r
+'********************************************************************************\r
+Sub  chk_in_workfolder( ByVal path )\r
+  Dim  sh, work\r
+\r
+  If g_workfolder = "" Then\r
+    Set sh = WScript.CreateObject("WScript.Shell")\r
+    work = sh.CurrentDirectory\r
+    sh = Empty\r
+  Else\r
+    work = g_workfolder\r
+  End If\r
+  work = g_fs.BuildPath( work, "a" )\r
+  work = Left( work, Len(work) - 1 )\r
+\r
+  path = g_fs.GetAbsolutePathName( path )\r
+\r
+  If work <> Left( path, Len( work ) ) Then\r
+    raise E_OutOfWorkFolder, path & " is out of working folder"\r
+  End If\r
+\r
+End Sub\r
+\r
\r
+'********************************************************************************\r
+'  <<< [fc] diff text file >>> \r
+' argument\r
+'  - return : True=same, False=different\r
+'********************************************************************************\r
+Function  fc( ByVal pathA, ByVal pathB )\r
+\r
+  ' File Compare\r
+  If g_fs.FileExists( pathA ) Then\r
+\r
+    Dim  sh, r\r
+    If Not g_fs.FileExists( pathB ) Then  fc=False : Exit Function\r
+\r
+    Set sh = WScript.CreateObject("WScript.Shell")\r
+    r = sh.Run( "fc.exe """ + pathA + """ """ + pathB + """", 7, True )\r
+    If r = E_ProgTerminated Then  raise E_ProgTerminated, "Program Terminated"\r
+    fc = ( r = 0 )\r
+\r
+\r
+  ' Folder Compare\r
+  ElseIf g_fs.FolderExists( pathA ) Then\r
+\r
+    Dim  foldersA, foldersB, folderA, folderB, foA, foB, step, f\r
+    If Not g_fs.FolderExists( pathB ) Then  fc=False : Exit Function\r
+\r
+    pathA = g_fs.GetAbsolutePathName( pathA )\r
+    pathB = g_fs.GetAbsolutePathName( pathB )\r
+    GetSubFolders  foldersA, pathA\r
+    GetSubFolders  foldersB, pathB\r
+\r
+    If Array_count( foldersA ) <> Array_count( foldersB ) Then  fc=False : Exit Function\r
+\r
+    For Each folderA In foldersA\r
+      step = Mid( folderA, Len( pathA ) + 1 )\r
+      If step = "" Then\r
+        folderB = pathB\r
+      Else\r
+        folderB = g_fs.BuildPath( pathB, step )\r
+      End If\r
+\r
+      Set foA = g_fs.GetFolder( folderA )\r
+      Set foB = g_fs.GetFolder( folderB )\r
+\r
+      If foA.Files.Count <> foB.Files.Count Then  fc=False : Exit Function\r
+      For Each f In foA.Files\r
+        If Not fc( f.Path, folderB + Mid( f.Path, Len( folderA ) + 1 ) ) Then\r
+          fc=False : Exit Function\r
+        End If\r
+      Next\r
+    Next\r
+\r
+    fc = True\r
+  Else\r
+    fc = False : Exit Function\r
+  End If\r
+End Function\r
+\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [find] find lines including keyword >>> \r
+'********************************************************************************\r
+Function  find( ByVal keyword, ByVal path )\r
+  Dim  f, line, ret\r
+  Set  f = g_fs.OpenTextFile( path )\r
+\r
+  ret = ""\r
+  Do Until f.AtEndOfStream\r
+    line = f.ReadLine\r
+    If InStr( line, keyword ) > 0 Then  ret = ret + line\r
+  Loop\r
+\r
+  f.Close\r
+\r
+  find = ret\r
+End Function\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [find_c] find lines count including keyword >>> \r
+'********************************************************************************\r
+Function  find_c( ByVal keyword, ByVal path )\r
+  Dim  f, line, ret\r
+  Set  f = g_fs.OpenTextFile( path )\r
+\r
+  ret = 0\r
+  Do Until f.AtEndOfStream\r
+    line = f.ReadLine\r
+    If InStr( line, keyword ) > 0 Then  ret = ret + 1\r
+  Loop\r
+\r
+  f.Close\r
+\r
+  find_c = ret\r
+End Function\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [del] >>> \r
+'********************************************************************************\r
+Sub  del( ByVal path )\r
+\r
+  ' If path had Wild card\r
+  If IsWildCard( path ) Then\r
+    Dim  folder, fname, fnames()\r
+\r
+    ExpandWildcard  folder, fnames, path\r
+    For Each fname in fnames\r
+      del  g_fs.BuildPath( folder, fname )\r
+    Next\r
+\r
+  ' If path was file or folder path\r
+  Else\r
+\r
+    If g_fs.FileExists( path ) Then\r
+      chk_in_workfolder  path\r
+      g_fs.DeleteFile  path\r
+    ElseIf g_fs.FolderExists( path ) Then\r
+      rmdir  path\r
+    End If\r
+  End If\r
+\r
+End Sub\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [mkdir] >>> \r
+' argument\r
+'  - return : count of made folder\r
+' comment\r
+'  - This is able to make nested folder.\r
+'********************************************************************************\r
+Function  mkdir( ByVal fo )\r
+  Dim  i, n, names(), fo2\r
+\r
+  chk_in_workfolder  fo\r
+\r
+  n = 0\r
+  fo2 = g_fs.GetAbsolutePathName( fo )\r
+  Do\r
+    If g_fs.FolderExists( fo2 ) Then Exit Do\r
+\r
+    n = n + 1\r
+    Redim Preserve  names(n)\r
+    names(n) = g_fs.GetFileName( fo2 )\r
+    fo2 = g_fs.GetParentFolderName( fo2 )\r
+  Loop\r
+\r
+  mkdir = n\r
+\r
+  For n=n To 1 Step -1\r
+    fo2 = g_fs.BuildPath( fo2, names(n) )\r
+    g_fs.CreateFolder  fo2\r
+  Next\r
+\r
+End Function\r
\r
+'********************************************************************************\r
+'  <<< [rmdir] >>> \r
+'********************************************************************************\r
+Sub  rmdir( ByVal path )\r
+  Dim  path2, iFolder, nFolder, fo, subf, f, file\r
+\r
+  If Not g_fs.FolderExists( path ) Then Exit Sub\r
+\r
+  chk_in_workfolder  path\r
+\r
+\r
+  ' Cut last \\r
+  path2 = path\r
+  If Right( path2, 1 ) = "\" Then  path2 = Left( path2, Len( path2 ) - 1 )\r
+\r
+  nFolder = 1\r
+  ReDim folderPathes(nFolder)\r
+  folderPathes(nFolder) = path2\r
+\r
+  ' Enum sub folders\r
+  iFolder = 1\r
+  While iFolder <= nFolder\r
+    Set fo = g_fs.GetFolder( folderPathes(iFolder) )\r
+    For Each subf in fo.SubFolders\r
+      nFolder = nFolder + 1\r
+      ReDim Preserve folderPathes(nFolder)\r
+      folderPathes(nFolder) = subf.Path\r
+    Next\r
+    iFolder = iFolder + 1\r
+  WEnd\r
+\r
+  ' Remove read only attribute of all files in sub folders\r
+  For iFolder = 1 To nFolder\r
+    Set fo = g_fs.GetFolder( folderPathes(iFolder) )\r
+    For Each f in fo.Files\r
+      Set file = g_fs.GetFile( f.Path )\r
+      file.Attributes = file.Attributes And Not ReadOnly\r
+    Next\r
+  Next\r
+\r
+  ' Delete folders\r
+  g_fs.DeleteFolder( path )\r
+End Sub\r
\r
+'********************************************************************************\r
+'  <<< [GetSubFolders] >>> \r
+' argument\r
+'  - folders : (out) array of folder pathes\r
+'  - path : base folder path\r
+'********************************************************************************\r
+Sub  GetSubFolders( folders, ByVal path )\r
+  Array_toEmpty  folders\r
+  EnumSubFolders  folders, g_fs.GetFolder( path )\r
+End Sub\r
+\r
+Sub  EnumSubFolders( folders, fo )\r
+  Dim  subfo\r
+\r
+  Array_push  folders, fo.Path\r
+\r
+  For Each subfo in fo.SubFolders\r
+    EnumSubFolders  folders, subfo\r
+  Next\r
+End Sub\r
\r
+'********************************************************************************\r
+'  <<< [IsWildcard] >>> \r
+'********************************************************************************\r
+Function  IsWildcard( ByVal path )\r
+  IsWildcard = InStr( path, "?" ) <> 0 Or InStr( path, "*" ) <> 0\r
+End Function\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [ExpandWildcard] >>> \r
+'********************************************************************************\r
+Sub  ExpandWildcard( folder, fnames, ByVal wildcard )\r
+  Dim  s, re, fo, f\r
+\r
+  folder = g_fs.GetParentFolderName( g_fs.GetAbsolutePathName( wildcard ) )\r
+\r
+  Set re = CreateObject("VBScript.RegExp")\r
+  re.Global = True\r
+  s = g_fs.GetFileName( wildcard )\r
+  re.Pattern = "\\" :  s = re.Replace( s, "\\" )\r
+  re.Pattern = "\." :  s = re.Replace( s, "\." )\r
+  re.Pattern = "\$" :  s = re.Replace( s, "\$" )\r
+  re.Pattern = "\^" :  s = re.Replace( s, "\^" )\r
+  re.Pattern = "\{" :  s = re.Replace( s, "\{" )\r
+  re.Pattern = "\}" :  s = re.Replace( s, "\}" )\r
+  re.Pattern = "\[" :  s = re.Replace( s, "\[" )\r
+  re.Pattern = "\]" :  s = re.Replace( s, "\]" )\r
+  re.Pattern = "\(" :  s = re.Replace( s, "\(" )\r
+  re.Pattern = "\)" :  s = re.Replace( s, "\)" )\r
+  re.Pattern = "\|" :  s = re.Replace( s, "\|" )\r
+  re.Pattern = "\+" :  s = re.Replace( s, "\+" )\r
+  re.Pattern = "\*" :  s = re.Replace( s, ".*" )\r
+  re.Pattern = "\?" :  s = re.Replace( s, "." )\r
+\r
+  re.Pattern = s\r
+  re.Global = False\r
+  Array_toEmpty  fnames\r
+  Set fo = g_fs.GetFolder( folder )\r
+  For Each f in fo.Files\r
+    If re.Test( f.Name )  Then  Array_push  fnames, f.Name\r
+  Next\r
+  For Each f in fo.SubFolders\r
+    If re.Test( f.Name )  Then  Array_push  fnames, f.Name\r
+  Next\r
+End Sub\r
+\r
\r
+'********************************************************************************\r
+'  <<< [start] >>> \r
+'********************************************************************************\r
+Sub  start( ByVal cmdline )\r
+  Dim  sh\r
+\r
+  Set sh = WScript.CreateObject("WScript.Shell")\r
+  sh.Run cmdline, 1, False\r
+\r
+End Sub\r
+\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [call_exe] >>> \r
+' comment\r
+'   - It is possible to call .bat file.\r
+'   - cmdline is able to have environment variable.\r
+'     ex) call_exe """%ProgramFiles%\Movie Maker\moviemk.exe"""\r
+'********************************************************************************\r
+Function  call_exe( ByVal cmdline )\r
+  Dim  sh, r\r
+\r
+  Set sh = WScript.CreateObject("WScript.Shell")\r
+\r
+  cmdline = sh.ExpandEnvironmentStrings( cmdline )\r
+  r = sh.Run( cmdline, 1, True )\r
+\r
+  If r = E_ProgTerminated Then  raise E_ProgTerminated, "Program Terminated"\r
+\r
+  call_exe = r\r
+End Function\r
+\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [call_exe_r] redirect >>> \r
+'********************************************************************************\r
+Function  call_exe_r( ByVal cmdline, ByVal inpath, ByVal outpath, ByVal errpath )\r
+  Dim  sh, ex, r, f, prev_txt\r
+\r
+  If inpath <> "" Then  raise E_AssertFail, "Not supported"\r
+\r
+  Set sh = WScript.CreateObject( "WScript.Shell" )\r
+  cmdline = sh.ExpandEnvironmentStrings( cmdline )\r
+\r
+  Set ex = sh.Exec( cmdline )\r
+  Do While ex.Status = 0\r
+    WScript.Sleep 100\r
+  Loop\r
+\r
+  If outpath <> "" Then\r
+\r
+    prev_txt = ""\r
+    If g_fs.FileExists( outpath ) Then\r
+      Set f = g_fs.OpenTextFile( outpath, 1 )\r
+      On Error Resume Next\r
+        prev_txt = f.ReadAll\r
+      e.Copy( Err ) : On Error GoTo 0 : If e.num <> 0 Then\r
+        If e.num <> &h3E Then  e.Raise\r
+        e.Clear\r
+      End If\r
+      f.Close\r
+    End If\r
+    Set f = g_fs.CreateTextFile( outpath, True, False )\r
+    f.Write  prev_txt\r
+    Do Until ex.StdOut.AtEndOfStream\r
+      f.WriteLine ex.StdOut.ReadLine\r
+    Loop\r
+\r
+    If outpath <> errpath Then\r
+      f.Close\r
+\r
+      prev_txt = ""\r
+      If g_fs.FileExists( errpath ) Then\r
+        Set f = g_fs.OpenTextFile( errpath, 1 )\r
+        On Error Resume Next\r
+          prev_txt = f.ReadAll\r
+        e.Copy( Err ) : On Error GoTo 0 : If e.num <> 0 Then\r
+          If e.num <> &h3E Then  e.Raise\r
+          e.Clear\r
+        End If\r
+        f.Close\r
+      End If\r
+\r
+      Set f = g_fs.CreateTextFile( errpath, True, False )\r
+    End If\r
+    Do Until ex.StdErr.AtEndOfStream\r
+      f.WriteLine ex.StdErr.ReadLine\r
+    Loop\r
+    f.Close\r
+  End If\r
+\r
+  call_exe_r = ex.ExitCode\r
+  ex = Empty\r
+End Function\r
\r
+'********************************************************************************\r
+'  <<< [call_vbs] >>> \r
+'   - path is able to have environment variable.\r
+'     ex) """%ProgramFiles%\Movie Maker\moviemk.exe"""\r
+'********************************************************************************\r
+Function  call_vbs( ByVal path, ByVal func, ByVal param )\r
+  Dim sh, oldDir, f, funcX, in_call\r
+\r
+  in_call = False\r
+  Set sh = WScript.CreateObject("WScript.Shell")\r
+  oldDir = sh.CurrentDirectory\r
+\r
+  path = sh.ExpandEnvironmentStrings( path )\r
+  path = g_fs.GetAbsolutePathName( path )\r
+  chk_exist path\r
+\r
+  On Error Resume Next  'try\r
+\r
+    sh.CurrentDirectory = g_fs.GetParentFolderName( path )\r
+\r
+    If Err=0 Then  Set f = g_fs.OpenTextFile( g_fs.GetFileName( path ) ) : ExecuteGlobal f.ReadAll()\r
+    If Err=&h411 Then  Err.Clear  ' Symbol Overrided\r
+    If Err=0 Then  Set funcX = GetRef( func )\r
+    If Err=0 Then  in_call = True : call_vbs = funcX( param )\r
+    If Err=0 Then  in_call = False\r
+\r
+  e.Copy( Err ) : On Error GoTo 0 : If e.num <> 0 Then  'catch\r
+    If in_call Then\r
+      e.Source = func + " in " + path\r
+      If path=WScript.ScriptFullName Then\r
+        echo "If you want to debug, Call directory " + func + " before On Error Resume Next."\r
+      Else\r
+        echo "If you want to debug, Start "+g_fs.GetFileName(path)+" directly."\r
+      End If\r
+    End If\r
+    If e.num = 5 Then  raise  E_NotFoundSymbol, "Not found func name '" + func + "' in " + path\r
+    e.Raise\r
+  End If  'finally\r
+\r
+    f.Close\r
+    sh.CurrentDirectory = oldDir\r
+\r
+  If e.num <> 0 Then  e.Raise\r
+End Function\r
+\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [call_vbs_exe] >>> \r
+'   - path is able to have environment variable.\r
+'     ex) """%ProgramFiles%\Movie Maker\moviemk.exe"""\r
+'   - This function craetes new process.\r
+'********************************************************************************\r
+Function  call_vbs_exe( ByVal path )\r
+  Dim sh, oldDir, f, funcX, ex, log_bk_path, t, param\r
+\r
+  Set sh = WScript.CreateObject("WScript.Shell")\r
+\r
+\r
+  ' Nest test_log.txt\r
+  If Not IsEmpty( g_log ) Then\r
+    g_log.Close\r
+    g_log = Empty\r
+\r
+    log_bk_path = "test_log_bk.txt"\r
+    Set f = g_fs.GetFile( Test_DefLogFName )\r
+    If exist( log_bk_path ) Then  g_fs.DeleteFile  log_bk_path\r
+    f.Name = log_bk_path\r
+    f = Empty\r
+  Else\r
+    log_bk_path = ""\r
+  End If\r
+\r
+\r
+  ' Change current directory\r
+  oldDir = sh.CurrentDirectory\r
+\r
+  path = sh.ExpandEnvironmentStrings( path )\r
+  path = g_fs.GetAbsolutePathName( path )\r
+  chk_exist path\r
+\r
+  sh.CurrentDirectory = g_fs.GetParentFolderName( path )\r
+\r
+\r
+  ' Execute\r
+  If log_bk_path <> "" Then param = " //nologo -sub_test" Else param = "" End If\r
+  Set ex = sh.Exec( "CScript """ + path + """" + param )\r
+\r
+  Do While ex.Status = 0\r
+    WScript.Sleep 100\r
+  Loop\r
+\r
+  Do Until ex.StdOut.AtEndOfStream\r
+    echo ex.StdOut.ReadLine\r
+  Loop\r
+\r
+\r
+  ' Return current directory\r
+  sh.CurrentDirectory = oldDir\r
+\r
+\r
+  ' Un-nest test_log.txt\r
+  If log_bk_path <> "" Then\r
+    If g_fs.FileExists( Test_DefLogFName ) Then\r
+      Set f = g_fs.OpenTextFile( log_bk_path, 1 )\r
+      t = f.ReadAll\r
+      f.Close\r
+    Else\r
+      t = ""\r
+    End If\r
+\r
+    Set f = g_fs.OpenTextFile( Test_DefLogFName, 1 )\r
+    t = t + f.ReadAll\r
+    f.Close\r
+    f = Empty\r
+\r
+    Set g_log = g_fs.CreateTextFile( Test_DefLogFName, 1 )\r
+    g_log.Write  t\r
+\r
+    g_fs.DeleteFile  log_bk_path\r
+  End If\r
+\r
+\r
+  ' Get and raise error level\r
+  If ex.ExitCode <> 0 Then\r
+    raise E_ProgRetNotZero, CStr( ex.ExitCode )\r
+  End If\r
+End Function\r
+\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [include] >>> \r
+'********************************************************************************\r
+Sub  include( ByVal path )\r
+  Dim sh, f\r
+\r
+  Set sh = WScript.CreateObject("WScript.Shell")\r
+\r
+  path = sh.ExpandEnvironmentStrings( path )\r
+  chk_exist path\r
+\r
+  On Error Resume Next\r
+\r
+    If Err=0 Then  Set f = g_fs.OpenTextFile( g_fs.GetFileName( path ) ) : ExecuteGlobal f.ReadAll()\r
+    If Err=&h411 Then  Err.Clear  ' Symbol Overrided\r
+\r
+  e.Copy( Err ) : On Error GoTo 0\r
+  If e.num=&h400 Or e.num=&h3EA Then e.Description = e.Description + " " + path  ' No Statement\r
+  If e.num <> 0 Then  e.Raise\r
+End Sub\r
\r
+'********************************************************************************\r
+'  <<< [env] Expand environment strings >>> \r
+'********************************************************************************\r
+Function  env( ByVal s )\r
+  Set sh = WScript.CreateObject("WScript.Shell")\r
+\r
+  env = sh.ExpandEnvironmentStrings( s )\r
+End Function\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [devenv] Visual Studio 2005 command line build >>> \r
+' sample\r
+'   pushd "src"\r
+'   devenv "sample.sln /rebuild", "Release"\r
+'   popd\r
+'********************************************************************************\r
+Sub  devenv( ByVal param, ByVal config )\r
+  Dim sh, r, cmdline\r
+  Set sh = WScript.CreateObject("WScript.Shell")\r
+\r
+  cmdline = Chr(34) + sh.RegRead( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\"+_\r
+            "InstallDir" ) + "devenv.exe" + Chr(34) +_\r
+            " " + param + " " + Chr(34) + config + Chr(34)\r
+  r = call_exe( cmdline )\r
+\r
+  If r <> 0 Then  raise E_BuildFail, "devenv failed " + param + " in " + sh.CurrentDirectory\r
+End Sub\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [devenv_clean] Visual Studio 2005 clean >>> \r
+' sample\r
+'   pushd "src"\r
+'   devenv_clean "sample.sln"\r
+'   popd\r
+'********************************************************************************\r
+Sub  devenv_clean( ByVal sln )\r
+  devenv sln+" /clean", "Release"\r
+  del "Release"\r
+  devenv sln+" /clean", "Debug"\r
+  del "Debug"\r
+  del "*.ncb"\r
+  del "*.suo"\r
+  del "*.user"\r
+End Sub\r
\r
+'********************************************************************************\r
+'  <<< [SendKeys] Send keyboard code stroke to OS >>> \r
+'********************************************************************************\r
+Sub  SendKeys( ByVal window_title, ByVal keycords, ByVal late_time )\r
+  Dim  sh\r
+  Set  sh = WScript.CreateObject("WScript.Shell")\r
+\r
+  WScript.Sleep late_time\r
+  sh.AppActivate( window_title )\r
+  WScript.Sleep 100\r
+  sh.SendKeys keycords\r
+End Sub\r
+\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [Sleep] >>> \r
+'********************************************************************************\r
+Sub  Sleep( ByVal msec )\r
+  Dim  sh\r
+  Set  sh = WScript.CreateObject("WScript.Shell")\r
+\r
+  WScript.Sleep msec\r
+End Sub\r
+\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [WaitForFile] Wait for make the file >>> \r
+'********************************************************************************\r
+Sub  WaitForFile( ByVal path )\r
+  While g_fs.FileExists( path ) = False\r
+    WScript.Sleep 1000\r
+  Wend\r
+End Sub\r
+\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [CreateFile] Create 1 line text file >>> \r
+'********************************************************************************\r
+Sub  CreateFile( ByVal path, ByVal text )\r
+  Dim  t, folder\r
+\r
+  chk_in_workfolder  path\r
+\r
+  path = g_fs.GetAbsolutePathName( path )\r
+  folder = g_fs.GetParentFolderName( path )\r
+  mkdir  folder\r
+\r
+  Set t = g_fs.CreateTextFile( path, True, False )\r
+  t.WriteLine text\r
+  t.Close\r
+End Sub\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [Array_toEmpty] >>> \r
+'********************************************************************************\r
+Sub  Array_toEmpty( arr )\r
+  ReDim  arr( -1 )\r
+End Sub\r
\r
+'********************************************************************************\r
+'  <<< [Array_push] >>> \r
+'********************************************************************************\r
+Sub  Array_push( arr, item )\r
+  ReDim Preserve  arr( UBound(arr) + 1 )\r
+  arr( UBound(arr) ) = item\r
+End Sub\r
\r
+'********************************************************************************\r
+'  <<< [Array_pop] >>> \r
+'********************************************************************************\r
+Function  Array_pop( arr )\r
+  Array_pop = arr( UBound(arr) )\r
+  ReDim Preserve  arr( UBound(arr) - 1 )\r
+End Function\r
\r
+'********************************************************************************\r
+'  <<< [Array_count] >>> \r
+'********************************************************************************\r
+Function  Array_count( arr )\r
+  Array_count = UBound(arr) + 1\r
+End Function\r
\r
+'********************************************************************************\r
+'  <<< [Array_echo] >>> \r
+'********************************************************************************\r
+Sub  Array_echo( arr )\r
+  Dim i\r
+\r
+  WScript.Echo  "count = " & Array_count( arr )\r
+  ' WScript.Echo  "LBound = " & LBound( arr ) & ", UBound = " & UBound( arr )\r
+  For Each i In arr\r
+    WScript.Echo  "each = " & i\r
+  Next\r
+End Sub\r
\r
+'********************************************************************************\r
+'  <<< [raise] >>> \r
+' argument\r
+'  - e_num : E_AssertFail, E_TestFail ...\r
+'********************************************************************************\r
+Sub  raise( ByVal e_num, ByVal e_desc )\r
+  Err.Raise  e_num, "[ERROR] VBSLib", e_desc\r
+End Sub\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [Err2] >>> \r
+'********************************************************************************\r
+Class Err2\r
+\r
+  Public  num          ' Err.Number\r
+  Public  Description  ' Err.Description (Error Message)\r
+  Public  Source       ' Err.Source\r
+  Public  ErrID        ' count of (num <> 0) in each first Copy after Clear\r
+  Public  RaiseID      ' count of (num <> 0) in Copy\r
+\r
+  Private Sub Class_Initialize\r
+    num = 0 : Description = "" : ErrID = 0 : RaiseID = 0\r
+  End Sub\r
+\r
+  Public Sub Copy( err )\r
+    num = err.Number\r
+    Description = err.Description\r
+    Source = err.Source\r
+    if num <> 0 Then RaiseID = RaiseID + 1 : if RaiseID = 1 Then ErrID = ErrID + 1\r
+\r
+    If ErrID = 1 Then Stop  ' if debug, Enable this line and "If e.ErrID <> ErrID_of_this-1 Then On Error Resume Next" in caller\r
+\r
+  End Sub\r
+\r
+  Public Sub Echo\r
+    Dim msg\r
+    msg = "[ERROR] 0x" & Hex(num) & " " & Description & " ErrID=" & ErrID\r
+    WScript.Echo msg\r
+    If Not IsEmpty( g_log ) Then  g_log.WriteLine msg\r
+  End Sub\r
+\r
+  Public Sub OverRaise( e_num, e_desc )\r
+    num = vbObjectError + e_num\r
+    Description = e_desc\r
+    Raise\r
+  End Sub\r
+\r
+  Public Sub Raise\r
+    Err.Raise num, Source, Description\r
+  End Sub\r
+\r
+  Public Sub Clear\r
+    num = 0 : Description = "" : RaiseID = 0\r
+  End Sub\r
+End Class\r
+\r
\r
+'********************************************************************************\r
+'  <<< [Test_init] >>> \r
+'********************************************************************************\r
+Dim  Test_nPass\r
+Dim  Test_nSkip\r
+Dim  Test_nNG\r
+Const Test_DefLogFName = "test_log.txt"\r
+\r
+Sub Test_init\r
+  Dim  sub_test ' Boolean\r
+\r
+  Set g_log = g_fs.CreateTextFile( Test_DefLogFName, True, False )\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"\r
+\r
+  Test_nPass = 0\r
+  Test_nSkip = 0\r
+  Test_nNG = 0\r
+End Sub\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [Test_do] >>> \r
+' comment\r
+'   If test failed, raise E_TestFail, ""\r
+'********************************************************************************\r
+Sub  Test_do( ByVal vbs_path, ByVal func, ByVal param )\r
+  echo "=========================================================="\r
+  echo "Test: " & vbs_path & " - " & func & " " & param\r
+\r
+  On Error Resume Next\r
+    call_vbs  vbs_path, func, param\r
+  e.Copy( Err ) : On Error GoTo 0 : If e.num <> 0 Then\r
+    if e.num = vbObjectError Then\r
+      echo "[SKIP] " & e.Description\r
+      Test_nSkip = Test_nSkip + 1\r
+    Else\r
+      e.Echo\r
+      Test_nNG = Test_nNG + 1\r
+    End If\r
+    e.Clear\r
+  Else\r
+    Test_nPass = Test_nPass + 1\r
+    echo "Pass."\r
+  End If\r
+\r
+End Sub\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [Test_exe] >>> \r
+'comment\r
+' - func and param is dummy.\r
+'********************************************************************************\r
+Sub  Test_exe( ByVal vbs_path, ByVal func, ByVal param )\r
+\r
+  On Error Resume Next\r
+    call_vbs_exe  vbs_path\r
+  e.Copy( Err ) : On Error GoTo 0 : If e.num <> 0 Then\r
+    if e.num = vbObjectError Then\r
+      echo "[SKIP] " & e.Description\r
+      Test_nSkip = Test_nSkip + 1\r
+    Else\r
+      e.Echo\r
+      Test_nNG = Test_nNG + 1\r
+    End If\r
+    e.Clear\r
+  Else\r
+    Test_nPass = Test_nPass + 1\r
+  End If\r
+\r
+End Sub\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [Test_skip] >>> \r
+'********************************************************************************\r
+Sub  Test_skip( ByVal desc )\r
+  Err.Raise  vbObjectError, "VBSLib", desc\r
+End Sub\r
+\r
+\r
\r
+'********************************************************************************\r
+'  <<< [Test_finish] >>> \r
+'********************************************************************************\r
+Sub Test_finish\r
+  Dim  sub_test ' Boolean\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
+    echo "=========================================================="\r
+    echo  "Test Finish (Pass=" & Test_nPass & ", SKIP=" & Test_nSkip & ", ERROR=" & Test_nNG & ")"\r
+  Else\r
+    If Test_nNG = 0 Then WScript.Quit 0  Else WScript.Quit 1  End If\r
+  End If\r
+\r
+  g_log = Empty\r
+End Sub\r
+\r
+\r
\r