Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
61
Task/Assertions/M2000-Interpreter/assertions-1.m2000
Normal file
61
Task/Assertions/M2000-Interpreter/assertions-1.m2000
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
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
|
||||
6
Task/Assertions/M2000-Interpreter/assertions-2.m2000
Normal file
6
Task/Assertions/M2000-Interpreter/assertions-2.m2000
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// escape off // using escape off interpreter skip assert statements
|
||||
x=random(0, 1)*10
|
||||
try {
|
||||
assert x=10
|
||||
print x
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue