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