Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/overload_set_algorithm_test.py

Issue 2731683002: [WebAgentsAPI]: Introduce OverloadSetAdapter. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/bindings/scripts/overload_set_algorithm.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2017 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 # pylint: disable=import-error,print-statement,relative-import,protected-access
6
7 """Unit tests for overload_set_algorithm.py."""
8
9 import unittest
10
11 from overload_set_algorithm import effective_overload_set
12 from overload_set_algorithm import MethodContextAdapter
13
14
15 class MethodContextAdapterTest(unittest.TestCase):
16 def test_simple(self):
17 adapter = MethodContextAdapter()
18 self.assertEqual(adapter.arguments({'arguments': 'foo'}), 'foo')
19 self.assertEqual(adapter.type({'idl_type_object': 'bar'}), 'bar')
20 self.assertEqual(adapter.is_optional({'is_optional': 'baz'}), 'baz')
21 self.assertEqual(adapter.is_variadic({'is_variadic': 'qux'}), 'qux')
22
23
24 class EffectiveOverloadSetTest(unittest.TestCase):
25 def test_example_in_comments(self):
26 operation_list = [
27 {'arguments': [{'idl_type_object': 'long', # f1(optional long x)
28 'is_optional': True,
29 'is_variadic': False}]},
30 {'arguments': [{'idl_type_object': 'DOMString', # f2(DOMString s)
31 'is_optional': False,
32 'is_variadic': False}]},
33 ]
34
35 overload_set = [
36 ({'arguments': [{'idl_type_object': 'long', # f1(long)
37 'is_optional': True,
38 'is_variadic': False}]},
39 ('long',),
40 (True,)),
41 ({'arguments': [{'idl_type_object': 'long', # f1()
42 'is_optional': True,
43 'is_variadic': False}]},
44 (),
45 ()),
46 ({'arguments': [{'idl_type_object': 'DOMString', # f2(DOMString)
47 'is_optional': False,
48 'is_variadic': False}]},
49 ('DOMString',),
50 (False,))]
51
52 self.assertEqual(
53 effective_overload_set(operation_list, MethodContextAdapter()),
54 overload_set)
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/scripts/overload_set_algorithm.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698