Skip to content

Commit

Permalink
nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralph-Wang committed Nov 18, 2013
1 parent 60122eb commit bef32dc
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
Binary file modified DataGen.vbs
Binary file not shown.
1 change: 1 addition & 0 deletions runTest.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
set pwd=%cd%
cd .\test
main.vbs
more test.log
cd %pwd%
24 changes: 10 additions & 14 deletions test/log.vbs
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
Option Explicit

Private Const LogName = "test.log" ' where to write

'test
Private Sub test()
writeLog("write a log")
End Sub
Private Const logFileName = "test.log" ' where to write
Private Const forAppending = 8 ' open files for append

Public Function writeLog(logMsg):
Dim localTime, NewLog, logFile
localTime = "[" & Now() & "]"
NewLog = localTime & " " & logMsg
Dim localTime, logFile
localTime = "[" & Now() & "]:"
logMsg = localTime & " " & logMsg
Set logFile = openLogFile()
logFile.WriteLine(NewLog)
logFile.WriteLine(logMsg)
Set logFile = Nothing
End Function

Private Function openLogFile()
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(LogName) Then
Set openLogFile = fso.OpenTextFile(LogName, 8, false)
If fso.FileExists(logFileName) Then
Set openLogFile = fso.OpenTextFile(logFileName, forAppending, false)
Else
fso.CreateTextFile(LogName)
Set openLogFile = fso.OpenTextFile(LogName, 8, false)
fso.CreateTextFile(logFileName)
Set openLogFile = fso.OpenTextFile(logFileName, forAppending, false)
End If
Set fso = Nothing
End Function
15 changes: 15 additions & 0 deletions test/main.vbs
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
include "log.vbs"
'writeLog "------------------------------"
'writeLog "test Start"
'''''''''''
' > test suits
'''''''''''
'writeLog "test Ended"
'------------------------------------------------------------
' include other *.vbs files
Function include(strFile)
Dim fso, file, content
Set fso = createObject("Scripting.FileSystemObject")
strFile = fso.getAbsolutePathName(strFile)
Set file = fso.openTextFile(strFile)
msgbox strFile
content = file.readAll()
file.close
msgbox content
ExecuteGlobal content
set fso = Nothing
set file = Nothing
End Function

' an implementation of assert
Function assert(expression, errDescription)
If not expression Then
err.raise 10000,"AssertError", errDescription
Expand Down

0 comments on commit bef32dc

Please sign in to comment.