Adrià Vilanova MartÃnez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 1 | // 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. |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 4 | |
| 5 | |
| 6 | function 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 | |
| 24 | function 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 | |
| 54 | function 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 | } |