Commit | Line | Data |
760ac839 |
1 | BEGIN { |
2 | chdir 't' if -d 't/lib'; |
3 | @INC = '../lib' if -d 'lib'; |
4 | require Config; import Config; |
bbad3607 |
5 | if (-d 'lib' and $Config{'extensions'} !~ /\bOS2(::|\/)REXX\b/) { |
760ac839 |
6 | print "1..0\n"; |
7 | exit 0; |
8 | } |
9 | } |
10 | |
11 | use OS2::REXX; |
12 | |
13 | $name = "VREXX"; |
14 | $path = $ENV{LIBPATH} || $ENV{PATH} or die; |
15 | foreach $dir (split(';', $path)) { |
16 | next unless -f "$dir/$name.DLL"; |
17 | $found = "$dir/$name.DLL"; |
18 | print "# found at `$found'\n"; |
19 | last; |
20 | } |
6e7c9e4d |
21 | $found or print "1..0 # skipped: cannot find $name.DLL\n" and exit; |
760ac839 |
22 | |
23 | print "1..10\n"; |
24 | |
25 | REXX_call { |
26 | $vrexx = DynaLoader::dl_load_file($found) or die "not ok 1\n# load\n"; |
27 | print "ok 1\n"; |
28 | $vinit = DynaLoader::dl_find_symbol($vrexx, "VINIT") or die "find vinit"; |
29 | print "ok 2\n"; |
30 | $vexit = DynaLoader::dl_find_symbol($vrexx, "VEXIT") or die "find vexit"; |
31 | print "ok 3\n"; |
32 | $vmsgbox = DynaLoader::dl_find_symbol($vrexx, "VMSGBOX") or die "find vmsgbox"; |
33 | print "ok 4\n"; |
34 | $vversion= DynaLoader::dl_find_symbol($vrexx, "VGETVERSION") or die "find vgetversion"; |
35 | print "ok 5\n"; |
36 | |
37 | $result = OS2::REXX::_call("VInit", $vinit) or die "VInit"; |
38 | print "ok 6\n"; |
39 | print "# VInit: $result\n"; |
40 | |
41 | OS2::REXX::_set("MBOX.0" => 4, |
42 | "MBOX.1" => "Perl VREXX Access Test", |
43 | "MBOX.2" => "", |
44 | "MBOX.3" => "(C) Andreas Kaiser", |
45 | "MBOX.4" => "December 1994") |
46 | or die "set var"; |
47 | print "ok 7\n"; |
48 | |
49 | $result = OS2::REXX::_call("VGetVersion", $vversion) or die "VMsgBox"; |
50 | print "ok 8\n"; |
51 | print "# VGetVersion: $result\n"; |
52 | |
53 | $result = OS2::REXX::_call("VMsgBox", $vmsgbox, "", "Perl", "MBOX", 1) or die "VMsgBox"; |
54 | print "ok 9\n"; |
55 | print "# VMsgBox: $result\n"; |
56 | |
57 | OS2::REXX::_call("VExit", $vexit); |
58 | print "ok 10\n"; |
59 | }; |