OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 /** | |
6 * @param {!Array<string>} list | |
7 * @return {string} | |
8 */ | |
9 function str(list) { | |
10 return JSON.stringify(list); | |
11 } | |
12 | |
13 /** | |
14 * @extends {testing.Test} | |
15 * @constructor | |
16 */ | |
17 function ActionServiceUnitTest() {} | |
18 | |
19 ActionServiceUnitTest.prototype = { | |
20 __proto__: testing.Test.prototype, | |
21 | |
22 /** @override */ | |
23 extraLibraries: [ | |
24 '../../../../ui/webui/resources/js/cr.js', | |
25 'action_service.js', | |
26 ], | |
27 }; | |
28 | |
29 TEST_F('ActionServiceUnitTest', 'splitTerms', function() { | |
30 var ActionService = downloads.ActionService; | |
dpapad
2015/12/03 01:19:41
Nit (optional): You can reduce repetition as follo
Dan Beam
2015/12/11 08:17:22
meh, more lines, more indirection
| |
31 assertEquals(str([]), str(ActionService.splitTerms(''))); | |
32 assertEquals(str([]), str(ActionService.splitTerms(' '))); | |
33 assertEquals(str(['a']), str(ActionService.splitTerms('a'))); | |
34 assertEquals(str(['a b']), str(ActionService.splitTerms('a b'))); | |
35 assertEquals(str(['a', 'b']), str(ActionService.splitTerms('a "b"'))); | |
36 assertEquals(str(['a', 'b', 'c']), str(ActionService.splitTerms('a "b" c'))); | |
37 }); | |
OLD | NEW |