2 # note the extra switch, for the test below
9 use Test::More tests => 55;
11 use English qw( -no_match_vars ) ;
15 is( $PID, $$, '$PID' );
18 is( $ARG, $_, '$ARG' );
21 is($ARG[0], $_[0], '@ARG' );
27 ok( !$PREMATCH, '$PREMATCH undefined' );
28 ok( !$MATCH, '$MATCH undefined' );
29 ok( !$POSTMATCH, '$POSTMATCH undefined' );
45 # since $| is 1, this should be true
46 ok( $OUTPUT_AUTOFLUSH, '$OUTPUT_AUTOFLUSH should be true' );
48 my $close = close OUT;
49 ok( !($close) == $CHILD_ERROR, '$CHILD_ERROR should be false' );
51 open(IN, "<en.tmp") if ($^O eq 'dos');
53 like( $foo, qr/ok 7/, '$OFS' );
55 # chomp is true because $ORS is "\n"
56 ok( chomp($foo), '$ORS should be \n' );
59 is( $FORMAT_NAME, 'OUT', '$FORMAT_NAME' );
60 is( $FORMAT_TOP_NAME, 'OUT_TOP', '$FORMAT_TOP_NAME' );
61 is( $FORMAT_FORMFEED, "\f", '$FORMAT_FORMFEED' );
62 is( $FORMAT_LINES_LEFT, 0, '$FORMAT_LINES_LEFT' );
63 is( $FORMAT_LINES_PER_PAGE, 60, '$FORMAT_LINES_PER_PAGE' );
64 is( $FORMAT_LINE_BREAK_CHARACTERS, " \n-", '$FORMAT_LINE_BREAK_CHARACTERS');
65 is( $FORMAT_PAGE_NUMBER, 0, '$FORMAT_PAGE_NUMBER' );
66 is( $ACCUMULATOR, $^A, '$ACCUMULATOR' );
68 undef $OUTPUT_FIELD_SEPARATOR;
70 if ($threads) { $" = "\n" } else { $LIST_SEPARATOR = "\n" };
72 @foo = split(/\n/, "@foo");
73 is( $foo[0], 8, '$"' );
74 is( $foo[1], 9, '$LIST_SEPARATOR' );
76 undef $OUTPUT_RECORD_SEPARATOR;
78 eval 'NO SUCH FUNCTION';
79 like( $EVAL_ERROR, qr/method/, '$EVAL_ERROR' );
81 is( $UID, $<, '$UID' );
82 is( $GID, $(, '$GID' );
83 is( $EUID, $>, '$EUID' );
84 is( $EGID, $), '$EGID' );
86 is( $PROGRAM_NAME, $0, '$PROGRAM_NAME' );
87 is( $BASETIME, $^T, '$BASETIME' );
89 is( $PERL_VERSION, $^V, '$PERL_VERSION' );
90 is( $DEBUGGING, $^D, '$DEBUGGING' );
92 is( $WARNING, 0, '$WARNING' );
93 like( $EXECUTABLE_NAME, qr/perl/i, '$EXECUTABLE_NAME' );
94 is( $OSNAME, $Config{osname}, '$OSNAME' );
97 ok( $SYSTEM_FD_MAX >= 2, '$SYSTEM_FD_MAX should be at least 2' );
99 is( $INPLACE_EDIT, '.inplace', '$INPLACE_EDIT' );
101 'aabbcc' =~ /(.{2}).+(.{2})(?{ 9 })/;
102 is( $LAST_PAREN_MATCH, 'cc', '$LAST_PARENT_MATCH' );
103 is( $LAST_REGEXP_CODE_RESULT, 9, '$LAST_REGEXP_CODE_RESULT' );
105 is( $LAST_MATCH_START[1], 0, '@LAST_MATCH_START' );
106 is( $LAST_MATCH_END[1], 2, '@LAST_MATCH_END' );
108 ok( !$PERLDB, '$PERLDB should be false' );
111 local $INPUT_RECORD_SEPARATOR = "\n\n";
112 like( <DATA>, qr/a paragraph./, '$INPUT_RECORD_SEPARATOR' );
114 like( <DATA>, qr/second paragraph..\z/s, '$INPUT_RECORD_SEPARATOR' );
116 is( $INPUT_LINE_NUMBER, 2, '$INPUT_LINE_NUMBER' );
119 $SUBSCRIPT_SEPARATOR = '|';
122 $hash{'a', 'b', 'c'} = 1;
123 my @keys = sort keys %hash;
125 is( $keys[0], 'a,b,c', '$SUBSCRIPT_SEPARATOR' );
126 is( $keys[1], 'd|e|f', '$SUBSCRIPT_SEPARATOR' );
128 eval { is( $EXCEPTIONS_BEING_CAUGHT, 1, '$EXCEPTIONS_BEING_CAUGHT' ) };
129 ok( !$EXCEPTIONS_BEING_CAUGHT, '$EXCEPTIONS_BEING_CAUGHT should be false' );
131 eval { local *F; my $f = 'asdasdasd'; ++$f while -e $f; open(F, $f); };
132 is( $OS_ERROR, $ERRNO, '$OS_ERROR' );
133 ok( $OS_ERROR{ENOENT}, '%OS_ERROR (ENOENT should be set)' );
141 main::is( $PREMATCH, 'a', '$PREMATCH defined' );
142 main::is( $MATCH, 'b', '$MATCH defined' );
143 main::is( $POSTMATCH, 'c', '$POSTMATCH defined' );
148 main::is( $s, "xtyz", '$MATCH defined in right side of s///' );
153 use English qw( -no_match_vars ) ;
157 main::ok( !$PREMATCH, '$PREMATCH disabled' );
158 main::ok( !$MATCH, '$MATCH disabled' );
159 main::ok( !$POSTMATCH, '$POSTMATCH disabled' );
165 This is a second paragraph.
166 It has several lines.