This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Merge branch 'release-5.29.2' into blead
[perl5.git] / t / re / keep_tabs.t
1 # This file contains tests where \t characters should not be expanded into
2 # spaces.
3
4 BEGIN {
5     chdir 't' if -d 't';
6     require './test.pl';
7 }
8
9 {
10       like("\t", qr/[a  b]/x, '\t not ignored under /x');
11     unlike("\t", qr/[a  b]/xx, '\t ignored under /xx');
12     like("a", qr/[a     b]/xx, '"a" matches qr/[a       b]/xx');
13     like("b", qr/[a     b]/xx, '"b" matches qr/[a       b]/xx');
14     like("\t", qr/[a\   b]/xx, '"\t" matches qr/[a\     b]/xx');
15     like("a", qr/[a\    b]/xx, '"a" matches qr/[a\      b]/xx');
16     like("b", qr/[a\    b]/xx, '"b" matches qr/[a\      b]/xx');
17
18       like("\t", qr/(?x:[a      b])/, '\t not ignored under /x');
19     unlike("\t", qr/(?xx:[a     b])/, '\t ignored under /xx');
20     like("a", qr/(?xx:[a        b])/, '"a" matches qr/(?xx:[a   b])/');
21     like("b", qr/(?xx:[a        b])/, '"b" matches qr/(?xx:[a   b])/');
22     like("\t", qr/(?xx:[a\      b])/, '"\t" matches qr/(?xx:[a\ b])/');
23     like("a", qr/(?xx:[a\       b])/, '"a" matches qr/(?xx:[a\  b])/');
24     like("b", qr/(?xx:[a\       b])/, '"b" matches qr/(?xx:[a\  b])/');
25 }
26
27 done_testing;
28
29 # ex softtabstop=0 noexpandtab