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 | # Before `make install' is performed this script should be runnable with |
12 | # `make test'. After `make install' it should work as `perl test.pl' |
13 | |
14 | ######################### We start with some black magic to print on failure. |
15 | |
16 | # Change 1..1 below to 1..last_test_to_print . |
17 | # (It may become useful if the test is moved to ./t subdirectory.) |
18 | |
19 | BEGIN { $| = 1; print "1..21\n"; } |
20 | END {print "not ok 1\n" unless $loaded;} |
21 | use OS2::ExtAttr; |
22 | $loaded = 1; |
23 | print "ok 1\n"; |
24 | |
25 | ######################### End of black magic. |
26 | |
27 | # Insert your test code below (better if it prints "ok 13" |
28 | # (correspondingly "not ok 13") depending on the success of chunk 13 |
29 | # of the test code): |
30 | |
89051be8 |
31 | unlink 't.out' if -f 't.out'; |
760ac839 |
32 | system 'cmd', '/c', 'echo OK > t.out'; |
33 | |
34 | { |
35 | my %a; |
36 | tie %a, 'OS2::ExtAttr', 't.out'; |
37 | print "ok 2\n"; |
38 | |
39 | keys %a == 0 ? print "ok 3\n" : print "not ok 3\n"; |
40 | $a{'++'} = '---'; |
41 | print "ok 4\n"; |
42 | $a{'AAA'} = 'xyz'; |
43 | print "ok 5\n"; |
44 | } |
45 | |
46 | { |
47 | my %a; |
48 | tie %a, 'OS2::ExtAttr', 't.out'; |
49 | print "ok 6\n"; |
50 | |
51 | my $c = keys %a; |
52 | $c == 2 ? print "ok 7\n" : print "not ok 7\n# c=$c\n"; |
53 | my @b = sort keys %a; |
54 | "@b" eq '++ AAA' ? print "ok 8\n" : print "not ok 8\n# keys=`@b'\n"; |
55 | $a{'++'} eq '---' ? print "ok 9\n" : print "not ok 9\n";; |
56 | $a{'AAA'} eq 'xyz' ? print "ok 10\n" : print "not ok 10\n# aaa->`$a{AAA}'\n"; |
57 | $c = delete $a{'++'}; |
58 | $c eq '---' ? print "ok 11\n" : print "not ok 11\n# deleted->`$c'\n";; |
59 | } |
60 | |
61 | print "ok 12\n"; |
62 | |
63 | { |
64 | my %a; |
65 | tie %a, 'OS2::ExtAttr', 't.out'; |
66 | print "ok 13\n"; |
67 | |
68 | keys %a == 1 ? print "ok 14\n" : print "not ok 14\n"; |
69 | my @b = sort keys %a; |
70 | "@b" eq 'AAA' ? print "ok 15\n" : print "not ok 15\n"; |
71 | $a{'AAA'} eq 'xyz' ? print "ok 16\n" : print "not ok 16\n";; |
72 | ! exists $a{'+'} ? print "ok 17\n" : print "not ok 17\n";; |
73 | ! defined $a{'+'} ? print "ok 18\n" : print "not ok 18\n# ->`$a{'++'}'\n";; |
74 | ! exists $a{'++'} ? print "ok 19\n" : print "not ok 19\n";; |
75 | ! defined $a{'++'} ? print "ok 20\n" : print "not ok 20\n# ->`$a{'++'}'\n";; |
76 | } |
77 | |
78 | print "ok 21\n"; |
bbad3607 |
79 | unlink 't.out'; |