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"; |
295d5f02 |
40 | # Standard Extended Attributes (SEAs) have a dot (.) as a prefix. |
41 | # This identifies the extended attribute as a SEA. The leading dot is reserved, |
42 | # so applications should not define extended attributes that start with a dot. |
43 | # Also, extended attributes |
44 | # that start with the characters $, @, &, or + are reserved for system use. |
45 | $a{'X--Y'} = '---'; # '++', -++', '!++', 'X++Y' fail on JFS |
760ac839 |
46 | print "ok 4\n"; |
295d5f02 |
47 | $a{'AAA'} = 'xyz'; # Name is going to be uppercased??? |
760ac839 |
48 | print "ok 5\n"; |
49 | } |
50 | |
51 | { |
52 | my %a; |
53 | tie %a, 'OS2::ExtAttr', 't.out'; |
54 | print "ok 6\n"; |
55 | |
56 | my $c = keys %a; |
57 | $c == 2 ? print "ok 7\n" : print "not ok 7\n# c=$c\n"; |
58 | my @b = sort keys %a; |
295d5f02 |
59 | "@b" eq 'AAA X--Y' ? print "ok 8\n" : print "not ok 8\n# keys=`@b'\n"; |
60 | $a{'X--Y'} eq '---' ? print "ok 9\n" : print "not ok 9\n";; |
760ac839 |
61 | $a{'AAA'} eq 'xyz' ? print "ok 10\n" : print "not ok 10\n# aaa->`$a{AAA}'\n"; |
295d5f02 |
62 | $c = delete $a{'X--Y'}; |
760ac839 |
63 | $c eq '---' ? print "ok 11\n" : print "not ok 11\n# deleted->`$c'\n";; |
64 | } |
65 | |
66 | print "ok 12\n"; |
67 | |
68 | { |
69 | my %a; |
70 | tie %a, 'OS2::ExtAttr', 't.out'; |
71 | print "ok 13\n"; |
72 | |
73 | keys %a == 1 ? print "ok 14\n" : print "not ok 14\n"; |
74 | my @b = sort keys %a; |
75 | "@b" eq 'AAA' ? print "ok 15\n" : print "not ok 15\n"; |
76 | $a{'AAA'} eq 'xyz' ? print "ok 16\n" : print "not ok 16\n";; |
77 | ! exists $a{'+'} ? print "ok 17\n" : print "not ok 17\n";; |
295d5f02 |
78 | ! defined $a{'+'} ? print "ok 18\n" : print "not ok 18\n# ->`$a{'X--Y'}'\n";; |
79 | ! exists $a{'X--Y'} ? print "ok 19\n" : print "not ok 19\n";; |
80 | ! defined $a{'X--Y'} ? print "ok 20\n" : print "not ok 20\n# ->`$a{'X--Y'}'\n";; |
760ac839 |
81 | } |
82 | |
83 | print "ok 21\n"; |
bbad3607 |
84 | unlink 't.out'; |
295d5f02 |
85 | |