summaryrefslogtreecommitdiff
path: root/t/uni/cache.t
blob: 74ce1f084a290eb3a67fb265c1b5761148df914f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
BEGIN {
    chdir 't' if -d 't';
    @INC = qw(../lib .);
    require "test.pl";
}

plan tests => 1;

# Looks to see if a "do 'unicore/lib/Sc/Hira.pl'" is called more than once, by
# putting a compile sub first on the libary path;
# XXX Kludge: requires exact path, which might change, and has deep knowledge
# of how utf8_heavy.pl works, which might also change.

BEGIN { # Make sure catches compile time references
    $::count = 0;
    unshift @INC, sub {
       $::count++ if $_[1] eq 'unicore/lib/Sc/Hira.pl';
    };
}

my $s = 'foo';

$s =~ m/[\p{Hiragana}]/;
$s =~ m/[\p{Hiragana}]/;
$s =~ m/[\p{Hiragana}]/;
$s =~ m/[\p{Hiragana}]/;

is($::count, 1, "Swatch hash caching kept us from reloading swatch hash.");