xref: /openbsd/gnu/usr.bin/perl/ext/re/t/re_funcs.t (revision 404b540a)
1#!./perl
2
3BEGIN {
4	chdir 't' if -d 't';
5	@INC = '../lib';
6	require Config;
7	if (($Config::Config{'extensions'} !~ /\bre\b/) ){
8        	print "1..0 # Skip -- Perl configured without re module\n";
9		exit 0;
10	}
11}
12
13use strict;
14use warnings;
15
16use Test::More; # test count at bottom of file
17use re qw(regmust);
18{
19    my $qr=qr/here .* there/x;
20    my ($anchored,$floating)=regmust($qr);
21    is($anchored,'here',"Regmust anchored - qr//");
22    is($floating,'there',"Regmust floating - qr//");
23    my $foo='blah';
24    ($anchored,$floating)=regmust($foo);
25    is($anchored,undef,"Regmust anchored - non ref");
26    is($floating,undef,"Regmust anchored - non ref");
27    my $bar=['blah'];
28    ($anchored,$floating)=regmust($foo);
29    is($anchored,undef,"Regmust anchored - ref");
30    is($floating,undef,"Regmust anchored - ref");
31}
32# New tests above this line, don't forget to update the test count below!
33use Test::More tests => 6;
34# No tests here!
35