summaryrefslogtreecommitdiff
path: root/os2/OS2/ExtAttr/t/os2_ea.t
blob: c1024193c17e78ae7c6c34d196db2fa0bd742003 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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;
    }
}

# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'

######################### We start with some black magic to print on failure.

# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)

BEGIN { $| = 1; print "1..21\n"; }
END {print "not ok 1\n" unless $loaded;}
use OS2::ExtAttr;
$loaded = 1;
print "ok 1\n";

######################### End of black magic.

# Insert your test code below (better if it prints "ok 13"
# (correspondingly "not ok 13") depending on the success of chunk 13
# of the test code):

system 'cmd', '/c', 'del t.out';
system 'cmd', '/c', 'echo OK > t.out';

{
  my %a;
  tie %a, 'OS2::ExtAttr', 't.out';
  print "ok 2\n";
  
  keys %a == 0 ? print "ok 3\n" : print "not ok 3\n";
  $a{'++'} = '---';
  print "ok 4\n";
  $a{'AAA'} = 'xyz';
  print "ok 5\n";
}

{
  my %a;
  tie %a, 'OS2::ExtAttr', 't.out';
  print "ok 6\n";
  
  my $c = keys %a;
  $c == 2 ? print "ok 7\n" : print "not ok 7\n# c=$c\n";
  my @b = sort keys %a;
  "@b" eq '++ AAA' ? print "ok 8\n" : print "not ok 8\n# keys=`@b'\n";
  $a{'++'} eq '---' ? print "ok 9\n" : print "not ok 9\n";;
  $a{'AAA'} eq 'xyz' ? print "ok 10\n" : print "not ok 10\n# aaa->`$a{AAA}'\n";
  $c = delete $a{'++'};
  $c eq '---' ? print "ok 11\n" : print "not ok 11\n# deleted->`$c'\n";;
}

print "ok 12\n";

{
  my %a;
  tie %a, 'OS2::ExtAttr', 't.out';
  print "ok 13\n";
  
  keys %a == 1 ? print "ok 14\n" : print "not ok 14\n";
  my @b = sort keys %a;
  "@b" eq 'AAA' ? print "ok 15\n" : print "not ok 15\n";
  $a{'AAA'} eq 'xyz' ? print "ok 16\n" : print "not ok 16\n";;
  ! exists $a{'+'} ? print "ok 17\n" : print "not ok 17\n";;
  ! defined $a{'+'} ? print "ok 18\n" : print "not ok 18\n# ->`$a{'++'}'\n";;
  ! exists $a{'++'} ? print "ok 19\n" : print "not ok 19\n";;
  ! defined $a{'++'} ? print "ok 20\n" : print "not ok 20\n# ->`$a{'++'}'\n";;
}

print "ok 21\n";