blob: 27d45bf77eb2b9a24cd2feeea4402a154187b414 [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001/* Copyright 2016 The Chromium Authors. All Rights Reserved.
2 *
3 * Use of this source code is governed by a BSD-style
4 * license that can be found in the LICENSE file or at
5 * https://developers.google.com/open-source/licenses/bsd
6 */
7
8
9function testKeepJustSummaryPrefixes_NoPrefixes() {
10 assertEquals(
11 '',
12 TKR_keepJustSummaryPrefixes(''));
13
14 assertEquals(
15 '',
16 TKR_keepJustSummaryPrefixes('Enter one line summary'));
17
18 assertEquals(
19 '',
20 TKR_keepJustSummaryPrefixes('Translation problem [en]'));
21
22 assertEquals(
23 '',
24 TKR_keepJustSummaryPrefixes('Crash at HH:MM'));
25}
26
27function testKeepJustSummaryPrefixes_WithColons() {
28 assertEquals(
29 'Security: ',
30 TKR_keepJustSummaryPrefixes('Security:'));
31
32 assertEquals(
33 'Exploit: ',
34 TKR_keepJustSummaryPrefixes('Exploit: remote exploit'));
35
36 assertEquals(
37 'XSS:Security: ',
38 TKR_keepJustSummaryPrefixes('XSS:Security: rest of summary'));
39
40 assertEquals(
41 'XSS: Security: ',
42 TKR_keepJustSummaryPrefixes('XSS: Security: rest of summary'));
43
44 assertEquals(
45 'XSS-Security: ',
46 TKR_keepJustSummaryPrefixes('XSS-Security: rest of summary'));
47
48 assertEquals(
49 'XSS: Security: ',
50 TKR_keepJustSummaryPrefixes('XSS: Security: rest [of] su:mmary'));
51
52 assertEquals(
53 'XSS-Security: ',
54 TKR_keepJustSummaryPrefixes('XSS-Security: rest [of] su:mmary'));
55}
56
57function testKeepJustSummaryPrefixes_WithBrackets() {
58 assertEquals(
59 '[Printing] ',
60 TKR_keepJustSummaryPrefixes('[Printing] problem with page'));
61
62 assertEquals(
63 '[Printing] ',
64 TKR_keepJustSummaryPrefixes('[Printing] problem with page'));
65
66 assertEquals(
67 '[l10n][en] ',
68 TKR_keepJustSummaryPrefixes('[l10n][en]Translation problem'));
69}