Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
dart-lang
sdk
tools
dom
scripts
multiemitter_test.py
Go to the documentation of this file.
1
#!/usr/bin/env python3
2
# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
3
# for details. All rights reserved. Use of this source code is governed by a
4
# BSD-style license that can be found in the LICENSE file.
5
"""Tests for emitter module."""
6
7
import
logging.config
8
import
unittest
9
import
emitter
10
import
multiemitter
11
12
13
class
MultiEmitterTestCase
(unittest.TestCase):
14
15
def
setUp
(self):
16
pass
17
18
def
tearDown
(self):
19
pass
20
21
def
check
(self, m, expected):
22
"""Verifies that the multiemitter contains the expected contents.
23
24
Expected is a list of (filename, content) pairs, sorted by filename.
25
"""
26
files = []
27
28
def
_Collect(file, contents):
29
files.append((file,
''
.join(contents)))
30
31
m.Flush(_Collect)
32
self.assertEqual(expected, files)
33
34
def
testExample
(self):
35
m =
multiemitter.MultiEmitter
()
36
e1 = m.FileEmitter(
'file1'
)
37
e2 = m.FileEmitter(
'file2'
,
'key2'
)
38
e1.Emit(
'Hi 1'
)
39
e2.Emit(
'Hi 2'
)
40
m.Find(
'key2'
).Emit(
'Bye 2'
)
41
self.
check
(m, [(
'file1'
,
'Hi 1'
), (
'file2'
,
'Hi 2Bye 2'
)])
42
43
44
if
__name__ ==
'__main__'
:
45
logging.config.fileConfig(
'logging.conf'
)
46
if
__name__ ==
'__main__'
:
47
unittest.main()
check
#define check(reporter, ref, unref, make, kill)
Definition
RefCntTest.cpp:85
scripts.multiemitter.MultiEmitter
Definition
multiemitter.py:17
scripts.multiemitter_test.MultiEmitterTestCase
Definition
multiemitter_test.py:13
scripts.multiemitter_test.MultiEmitterTestCase.testExample
testExample(self)
Definition
multiemitter_test.py:34
scripts.multiemitter_test.MultiEmitterTestCase.setUp
setUp(self)
Definition
multiemitter_test.py:15
scripts.multiemitter_test.MultiEmitterTestCase.check
check(self, m, expected)
Definition
multiemitter_test.py:21
scripts.multiemitter_test.MultiEmitterTestCase.tearDown
tearDown(self)
Definition
multiemitter_test.py:18
Generated on Fri Apr 26 2024 06:15:22 for Flutter Engine by
1.9.8