1 // Any copyright is dedicated to the Public Domain.
2 // http://creativecommons.org/publicdomain/zero/1.0/
5 checkPublicSuffix(null, null);
7 checkPublicSuffix('COM', null);
8 checkPublicSuffix('example.COM', 'example.com');
9 checkPublicSuffix('WwW.example.COM', 'example.com');
11 checkPublicSuffix('.com', null);
12 checkPublicSuffix('.example', null);
13 checkPublicSuffix('.example.com', null);
14 checkPublicSuffix('.example.example', null);
16 checkPublicSuffix('example', null);
17 checkPublicSuffix('example.example', 'example.example');
18 checkPublicSuffix('b.example.example', 'example.example');
19 checkPublicSuffix('a.b.example.example', 'example.example');
20 // Listed, but non-Internet, TLD.
21 //checkPublicSuffix('local', null);
22 //checkPublicSuffix('example.local', null);
23 //checkPublicSuffix('b.example.local', null);
24 //checkPublicSuffix('a.b.example.local', null);
25 // TLD with only 1 rule.
26 checkPublicSuffix('biz', null);
27 checkPublicSuffix('domain.biz', 'domain.biz');
28 checkPublicSuffix('b.domain.biz', 'domain.biz');
29 checkPublicSuffix('a.b.domain.biz', 'domain.biz');
30 // TLD with some 2-level rules.
31 checkPublicSuffix('com', null);
32 checkPublicSuffix('example.com', 'example.com');
33 checkPublicSuffix('b.example.com', 'example.com');
34 checkPublicSuffix('a.b.example.com', 'example.com');
35 checkPublicSuffix('uk.com', null);
36 checkPublicSuffix('example.uk.com', 'example.uk.com');
37 checkPublicSuffix('b.example.uk.com', 'example.uk.com');
38 checkPublicSuffix('a.b.example.uk.com', 'example.uk.com');
39 checkPublicSuffix('test.ac', 'test.ac');
40 // TLD with only 1 (wildcard) rule.
41 checkPublicSuffix('bd', null);
42 checkPublicSuffix('c.bd', null);
43 checkPublicSuffix('b.c.bd', 'b.c.bd');
44 checkPublicSuffix('a.b.c.bd', 'b.c.bd');
46 checkPublicSuffix('jp', null);
47 checkPublicSuffix('test.jp', 'test.jp');
48 checkPublicSuffix('www.test.jp', 'test.jp');
49 checkPublicSuffix('ac.jp', null);
50 checkPublicSuffix('test.ac.jp', 'test.ac.jp');
51 checkPublicSuffix('www.test.ac.jp', 'test.ac.jp');
52 checkPublicSuffix('kyoto.jp', null);
53 checkPublicSuffix('test.kyoto.jp', 'test.kyoto.jp');
54 checkPublicSuffix('ide.kyoto.jp', null);
55 checkPublicSuffix('b.ide.kyoto.jp', 'b.ide.kyoto.jp');
56 checkPublicSuffix('a.b.ide.kyoto.jp', 'b.ide.kyoto.jp');
57 checkPublicSuffix('c.kobe.jp', null);
58 checkPublicSuffix('b.c.kobe.jp', 'b.c.kobe.jp');
59 checkPublicSuffix('a.b.c.kobe.jp', 'b.c.kobe.jp');
60 checkPublicSuffix('city.kobe.jp', 'city.kobe.jp');
61 checkPublicSuffix('www.city.kobe.jp', 'city.kobe.jp');
62 // TLD with a wildcard rule and exceptions.
63 checkPublicSuffix('ck', null);
64 checkPublicSuffix('test.ck', null);
65 checkPublicSuffix('b.test.ck', 'b.test.ck');
66 checkPublicSuffix('a.b.test.ck', 'b.test.ck');
67 checkPublicSuffix('www.ck', 'www.ck');
68 checkPublicSuffix('www.www.ck', 'www.ck');
70 checkPublicSuffix('us', null);
71 checkPublicSuffix('test.us', 'test.us');
72 checkPublicSuffix('www.test.us', 'test.us');
73 checkPublicSuffix('ak.us', null);
74 checkPublicSuffix('test.ak.us', 'test.ak.us');
75 checkPublicSuffix('www.test.ak.us', 'test.ak.us');
76 checkPublicSuffix('k12.ak.us', null);
77 checkPublicSuffix('test.k12.ak.us', 'test.k12.ak.us');
78 checkPublicSuffix('www.test.k12.ak.us', 'test.k12.ak.us');
80 checkPublicSuffix('食狮.com.cn', '食狮.com.cn');
81 checkPublicSuffix('食狮.公司.cn', '食狮.公司.cn');
82 checkPublicSuffix('www.食狮.公司.cn', '食狮.公司.cn');
83 checkPublicSuffix('shishi.公司.cn', 'shishi.公司.cn');
84 checkPublicSuffix('公司.cn', null);
85 checkPublicSuffix('食狮.中国', '食狮.中国');
86 checkPublicSuffix('www.食狮.中国', '食狮.中国');
87 checkPublicSuffix('shishi.中国', 'shishi.中国');
88 checkPublicSuffix('中国', null);
89 // Same as above, but punycoded.
90 checkPublicSuffix('xn--85x722f.com.cn', 'xn--85x722f.com.cn');
91 checkPublicSuffix('xn--85x722f.xn--55qx5d.cn', 'xn--85x722f.xn--55qx5d.cn');
92 checkPublicSuffix('www.xn--85x722f.xn--55qx5d.cn', 'xn--85x722f.xn--55qx5d.cn');
93 checkPublicSuffix('shishi.xn--55qx5d.cn', 'shishi.xn--55qx5d.cn');
94 checkPublicSuffix('xn--55qx5d.cn', null);
95 checkPublicSuffix('xn--85x722f.xn--fiqs8s', 'xn--85x722f.xn--fiqs8s');
96 checkPublicSuffix('www.xn--85x722f.xn--fiqs8s', 'xn--85x722f.xn--fiqs8s');
97 checkPublicSuffix('shishi.xn--fiqs8s', 'shishi.xn--fiqs8s');
98 checkPublicSuffix('xn--fiqs8s', null);