summaryrefslogtreecommitdiff
path: root/os2/OS2/REXX/t/rx_tievar.t
diff options
context:
space:
mode:
authorLarry Wall <lwall@sems.com>1996-08-10 15:24:58 +0000
committerLarry Wall <lwall@sems.com>1996-08-10 15:24:58 +0000
commit760ac839baf413929cd31cc32ffd6dba6b781a81 (patch)
tree010ae8135426972c27b065782284341c839dc2a0 /os2/OS2/REXX/t/rx_tievar.t
parent43cc1d52f97c5f21f3207f045444707e7be33927 (diff)
downloadperl-760ac839baf413929cd31cc32ffd6dba6b781a81.tar.gz
perl 5.003_02: [no incremental changelog available]
Diffstat (limited to 'os2/OS2/REXX/t/rx_tievar.t')
-rw-r--r--os2/OS2/REXX/t/rx_tievar.t88
1 files changed, 88 insertions, 0 deletions
diff --git a/os2/OS2/REXX/t/rx_tievar.t b/os2/OS2/REXX/t/rx_tievar.t
new file mode 100644
index 0000000000..6132e23f80
--- /dev/null
+++ b/os2/OS2/REXX/t/rx_tievar.t
@@ -0,0 +1,88 @@
+BEGIN {
+ chdir 't' if -d 't/lib';
+ @INC = '../lib' if -d 'lib';
+ require Config; import Config;
+ if (-d 'lib' and $Config{'extensions'} !~ /\bOS2::REXX\b/) {
+ print "1..0\n";
+ exit 0;
+ }
+}
+
+use OS2::REXX;
+
+#
+# DLL
+#
+load OS2::REXX "ydbautil" or die "1..0\n# load\n";
+
+print "1..19\n";
+
+REXX_call {
+ print "ok 1\n";
+
+ #
+ # scalar
+ #
+ tie $s, OS2::REXX, "TEST";
+ print "ok 2\n";
+ $s = 1;
+ print "ok 3\n" if $s eq 1;
+ print "not ok 3\n# `$s'\n" unless $s eq 1;
+ untie $s;
+
+ #
+ # hash
+ #
+
+ tie %all, OS2::REXX, ""; # all REXX vars
+ print "ok 4\n";
+
+ sub show {
+ # show all REXX vars
+ print "--@_--\n";
+ foreach (keys %all) {
+ $v = $all{$_};
+ print "$_ => $v\n";
+ }
+ }
+
+ sub check {
+ # check all REXX vars
+ my ($test, @arr) = @_;
+ my @rx;
+ foreach $key (sort keys %all) { push @rx, $key, $all{$key} }
+ if ("@rx" eq "@arr") {print "ok $test\n"}
+ else { print "not ok $test\n# expect `@arr', got `@rx'\n" }
+ }
+
+
+ tie %h, OS2::REXX, "TEST.";
+ print "ok 5\n";
+ check(6);
+
+ $h{"one"} = 1;
+ check(7, "TEST.one", 1);
+
+ $h{"two"} = 2;
+ check(8, "TEST.one", 1, "TEST.two", 2);
+
+ $h{"one"} = "";
+ check(9, "TEST.one", "", "TEST.two", 2);
+ print "ok 10\n" if exists $h{"one"};
+ print "ok 11\n" if exists $h{"two"};
+
+ delete $h{"one"};
+ check(12, "TEST.two", 2);
+ print "ok 13\n" if not exists $h{"one"};
+ print "ok 14\n" if exists $h{"two"};
+
+ OS2::REXX::dropall("TEST.");
+ print "ok 15\n";
+ check(16);
+ print "ok 17\n" if not exists $h{"one"};
+ print "ok 18\n" if not exists $h{"two"};
+
+ untie %h;
+ print "ok 19";
+
+};