~ubuntu-branches/ubuntu/saucy/padre/saucy-proposed

« back to all changes in this revision

Viewing changes to t/81_search.t

  • Committer: Package Import Robot
  • Author(s): Dominique Dumont, gregor herrmann, Dominique Dumont
  • Date: 2012-01-04 12:04:20 UTC
  • mfrom: (1.3.3)
  • Revision ID: package-import@ubuntu.com-20120104120420-i5oybqwf91m1d3il
Tags: 0.92.ds1-1
[ gregor herrmann ]
* Remove debian/source/local-options; abort-on-upstream-changes
  and unapply-patches are default in dpkg-source since 1.16.1.
* Swap order of alternative (build) dependencies after the perl
  5.14 transition.

[ Dominique Dumont ]
* Imported Upstream version 0.92.ds1
* removed fix-spelling patch (applied upstream)
* lintian-override: use wildcard to avoid listing a gazillion files
* updated size of some 'not-real-man-page' entries
* rules: remove dekstop cruft (replaced by a file provided in debian
  directory)
* control: removed Breaks statement. Add /me to uploaders. Updated
  dependencies
* rules: make sure that non-DFSG file (i.e. the cute butterfly, sigh)
  is not distributed

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
use strict;
 
4
use warnings;
 
5
use Test::More;
 
6
 
 
7
BEGIN {
 
8
        unless ( $ENV{DISPLAY} or $^O eq 'MSWin32' ) {
 
9
                plan skip_all => 'Needs DISPLAY';
 
10
                exit 0;
 
11
        }
 
12
        plan tests => 15;
 
13
}
 
14
use Test::NoWarnings;
 
15
use t::lib::Padre;
 
16
use Padre::Util ();
 
17
 
 
18
SCOPE: {
 
19
        my ( $start, $end, @matches ) = Padre::Util::get_matches( "abc", qr/x/, 0, 0 );
 
20
        is_deeply( \@matches, [], 'no match' );
 
21
}
 
22
 
 
23
SCOPE: {
 
24
        my (@matches) = Padre::Util::get_matches( "abc", qr/(b)/, 0, 0 );
 
25
        is_deeply( \@matches, [ 1, 2, [ 1, 2 ] ], 'one match' );
 
26
}
 
27
 
 
28
SCOPE: {
 
29
        my (@matches) = Padre::Util::get_matches( "abcbxb", qr/(b)/, 0, 0 );
 
30
        is_deeply( \@matches, [ 1, 2, [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ], 'three matches' );
 
31
}
 
32
 
 
33
SCOPE: {
 
34
        my (@matches) = Padre::Util::get_matches( "abcbxb", qr/(b)/, 1, 2 );
 
35
        is_deeply( \@matches, [ 3, 4, [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ], 'three matches' );
 
36
}
 
37
 
 
38
SCOPE: {
 
39
        my (@matches) = Padre::Util::get_matches( "abcbxb", qr/(b)/, 3, 4 );
 
40
        is_deeply( \@matches, [ 5, 6, [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ], 'three matches' );
 
41
}
 
42
 
 
43
SCOPE: {
 
44
        my (@matches) = Padre::Util::get_matches( "abcbxb", qr/(b)/, 5, 6 );
 
45
        is_deeply( \@matches, [ 1, 2, [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ], 'three matches, wrapping' );
 
46
}
 
47
 
 
48
SCOPE: {
 
49
        my (@matches) = Padre::Util::get_matches( "abcbxb", qr/(b)/, 5, 6, 1 );
 
50
        is_deeply( \@matches, [ 3, 4, [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ], 'three matches backwards' );
 
51
}
 
52
 
 
53
SCOPE: {
 
54
        my (@matches) = Padre::Util::get_matches( "abcbxb", qr/(b)/, 1, 2, 1 );
 
55
        is_deeply( \@matches, [ 5, 6, [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ], 'three matches backwards wrapping' );
 
56
}
 
57
 
 
58
SCOPE: {
 
59
        my (@matches) = Padre::Util::get_matches( "abcbxb", qr/(b(.))/, 1, 2 );
 
60
        is_deeply( \@matches, [ 3, 5, [ 1, 3 ], [ 3, 5 ] ], '2 matches' );
 
61
}
 
62
 
 
63
SCOPE: {
 
64
        my (@matches) = Padre::Util::get_matches( "abcbxb", qr/(b(.?))/, 1, 2, 1 );
 
65
        is_deeply( \@matches, [ 5, 6, [ 1, 3 ], [ 3, 5 ], [ 5, 6 ] ], 'three matches bw, wrap' );
 
66
}
 
67
 
 
68
SCOPE: {
 
69
        my $str = qq( perl ("שלום"); perl );
 
70
        my (@matches) = Padre::Util::get_matches( $str, qr/(perl)/, 0, 0 );
 
71
 
 
72
        # TODO are these really correct numbers?
 
73
        is_deeply( \@matches, [ 1, 5, [ 1, 5 ], [ 28, 32 ] ], 'two matches with unicode' );
 
74
        is( substr( $str, 1, 4 ), 'perl' );
 
75
}
 
76
 
 
77
SCOPE: {
 
78
        my $str = 'müssen';
 
79
        my (@matches) = Padre::Util::get_matches( $str, qr/(üss)/, 0, 0 );
 
80
        is_deeply( \@matches, [ 1, 7, [ 1, 7 ] ], 'one match with unicode regex' );
 
81
        is( substr( $str, 1, 4 ), 'üss' );
 
82
}