File: 50_owner.t

package info (click to toggle)
libstring-copyright-perl 0.003014-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 284 kB
  • sloc: perl: 177; makefile: 2; sh: 1
file content (92 lines) | stat: -rw-r--r-- 4,158 bytes parent folder | download
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
use Test2::V0;

plan 52;

use String::Copyright {
	format => sub { join ':', $_->[0] || '', $_->[1] || '' }
};

is copyright("© 1999 12345 Steps"),
	'1999:12345 Steps',
	'year-like owner';

is copyright("© 1999 1234 Steps"),
	'1234, 1999:Steps',
	'too-year-like owner';

is copyright("© Foo"), ':Foo', 'year-less owner';

is copyright("© , Foo"),         ':Foo', 'messy owner starting with comma';
is copyright("Copyright,, Foo"),  '', 'messy owner starting with dual comma';
is copyright("Copyright, , Foo"), '', 'messy owner starting with dual comma';

is copyright("© - Foo"),      ':Foo',     'owner after dash';
is copyright("© -- Foo"),     ':Foo',     'owner after double dash';
is copyright("© 1999 - Foo"), '1999:Foo', 'owner after year and dash';
is copyright("© 1999 -- Foo"), '1999:Foo',
	'owner after year and double-dash';

is copyright("© -Foo"),       '', 'bogus owner starting with dash';
is copyright("© --Foo"),      '', 'bogus owner starting with double dash';
is copyright("© [yyyy] Foo"), '', 'bogus owner starting with template year';

is copyright("© (Foo)"), ':(Foo)', 'owner starting with paranthesis';

is copyright('© Foo (Bar) Baz'), ':Foo (Bar) Baz',
	'owner with non-first word in parenthesis';

is copyright('© Foo (Bar Baz)'), ':Foo (Bar Baz)',
	'owner with non-first words in parenthesis';

is copyright('© (Foo) Bar Baz'), ':(Foo) Bar Baz',
	'owner with first word in parenthesis';

# TODO: either exclude these or reduce owner initial regexp
is copyright('© ?Foo'), ':Foo',  'messy owner starting with question mark';
is copyright('© *Foo'), ':*Foo', 'messy owner starting with asterisk';
is copyright('© ,Foo'), ':Foo',  'messy owner starting with comma';
is copyright('© <Foo'), ':<Foo', 'messy owner starting with chevron';
is copyright('© @Foo'), ':@Foo', 'messy owner starting with at sign';
is copyright('© [Foo'), ':[Foo', 'messy owner starting with bracket';
is copyright('© {Foo'), ':{Foo', 'messy owner starting with brace';

is copyright('and (c) all begin '), '', 'bogus owner starting with all begin';

is copyright('© !Foo'),   '',     'bogus owner starting with bang';
is copyright('© \'Foo'),  '',     'bogus owner starting with singlequote';
is copyright('© "Foo'),   '',     'bogus owner starting with doublequote';
is copyright('© #Foo'),   '',     'bogus owner starting with hash';
is copyright('© $Foo'),   '',     'bogus owner starting with dollar';
is copyright('© %Foo'),   '',     'bogus owner starting with percent';
is copyright('© &Foo'),   '',     'bogus owner starting with ampersand';
is copyright("© ( Foo)"), '',     'bogus owner starting with lone paren';
is copyright('© )Foo'),   '',     'bogus owner starting with end-bracket';
is copyright('© +Foo'),   '',     'bogus owner starting with plus';
is copyright('© . Foo'),  '',     'bogus owner starting with dot';
is copyright('© :Foo'),   ':Foo', 'owner starting with colon';
is copyright('© ;Foo'),   '',     'bogus owner starting with semicolon';
is copyright('© >Foo'),   '',     'bogus owner starting with end chevron';
is copyright('© =Foo'),   '',     'bogus owner starting with equals';
is copyright('© ]Foo'),   '',     'bogus owner starting with end bracket';
is copyright('© \Foo'),   '',     'bogus owner starting with backslash';
is copyright('© ^Foo'),   '',     'bogus owner starting with caret';
is copyright('© _Foo'),   '',     'bogus owner starting with underscore';
is copyright('© `Foo'),   '',     'bogus owner starting with backtick';
is copyright('© }Foo'),   '',     'bogus owner starting with end brace';
is copyright('© |Foo'),   '',     'bogus owner starting with pipe';
is copyright('© ~Foo'),   '',     'bogus owner starting with tilde';

is copyright("Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER"), '',
	'bogus owner starting with YEAR';

is copyright('© Foo, all rights reserved.'), ':Foo', 'boilerplate';

is copyright('© Foo, all rights reserved. Bar'), ':Foo',
	'boilerplate, then noise';

my $todo = todo 'not yet handled';

is copyright('© Foo, all rights reserved. © Bar'), ":Foo\n:Bar",
	'boilerplate, then another copyright';

done_testing;