mirror of
https://github.com/fedapo/vb6-parser.git
synced 2025-12-17 16:44:35 +03:00
Review all tests
This commit is contained in:
50
test/test_gosub.cpp
Normal file
50
test/test_gosub.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
//
|
||||
|
||||
#include <csetjmp>
|
||||
#include <iostream>
|
||||
|
||||
#define VB6_GOSUB(sub) if(!setjmp(_gs)){goto sub;}
|
||||
#define VB6_RETURN longjmp(_gs,1)
|
||||
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
Sub foo()
|
||||
GoSub mysub1
|
||||
|
||||
Exit Sub
|
||||
mysub1:
|
||||
Debug.Print "mysub1"
|
||||
Return
|
||||
|
||||
mysub2:
|
||||
Debug.Print "mysub2"
|
||||
Return
|
||||
End Sub
|
||||
|
||||
#define GOSUB(sub) if(!setjmp(_gs)){goto sub;}
|
||||
#define RETURN longjmp(_gs,1)
|
||||
*/
|
||||
|
||||
void test_gosub(ostream& os)
|
||||
{
|
||||
os << "---- begin " << __func__ << " ----\n";
|
||||
|
||||
jmp_buf _gs;
|
||||
VB6_GOSUB(sub1);
|
||||
|
||||
os << " after calling subroutine 1\n";
|
||||
|
||||
VB6_GOSUB(sub2);
|
||||
|
||||
os << " after calling subroutine 2\n";
|
||||
|
||||
return;
|
||||
sub1:
|
||||
os << " in subroutine 1\n";
|
||||
VB6_RETURN;
|
||||
|
||||
sub2:
|
||||
os << " in subroutine 2\n";
|
||||
VB6_RETURN;
|
||||
}
|
||||
Reference in New Issue
Block a user