61 lines
1.7 KiB
Text
61 lines
1.7 KiB
Text
Module Assert {
|
|
\\ This is a global object named Rec
|
|
Global Group Rec {
|
|
Private:
|
|
document doc$="Error List at "+date$(today)+" "+time$(now)+{
|
|
}
|
|
Public:
|
|
lastfilename$="noname.err"
|
|
Module Error(a$) {
|
|
if a$="" then exit
|
|
.doc$<=" "+a$+{
|
|
}
|
|
flush error
|
|
}
|
|
Module Reset {
|
|
Clear .doc$
|
|
}
|
|
Module Display {
|
|
Report .doc$
|
|
}
|
|
Module SaveIt {
|
|
.lastfilename$<=replace$("/", "-","Err"+date$(today)+str$(now, "-nn-mm")+".err")
|
|
Save.Doc .doc$,.lastfilename$
|
|
}
|
|
}
|
|
Module Checkit {
|
|
Function Error1 (x) {
|
|
if x<10 then Print "Normal" : exit
|
|
=130 ' error code
|
|
}
|
|
Call Error1(5)
|
|
Try ok {
|
|
Call Error1(100)
|
|
}
|
|
If not Ok then Rec.Error Error$ : Flush Error
|
|
|
|
Test "breakpoint A" ' open Control form, show code as executed, press next or close it
|
|
|
|
Try {
|
|
Test
|
|
Report "Run this"
|
|
Error "Hello"
|
|
Report "Not run this"
|
|
}
|
|
Rec.Error Error$
|
|
|
|
Module Error1 (x) {
|
|
if x<10 then Print "Normal" : exit
|
|
Error "Big Error"
|
|
}
|
|
Try ok {
|
|
Error1 100
|
|
}
|
|
If Error then Rec.Error Error$
|
|
}
|
|
Checkit
|
|
Rec.Display
|
|
Rec.SaveIt
|
|
win "notepad.exe", dir$+Rec.lastfilename$
|
|
}
|
|
Assert
|