|
7 | 7 | import 'package:dwds/src/debugging/dart_scope.dart'; |
8 | 8 | import 'package:dwds/src/services/chrome_proxy_service.dart'; |
9 | 9 | import 'package:test/test.dart'; |
| 10 | +import 'package:test_common/logging.dart'; |
10 | 11 | import 'package:test_common/test_sdk_configuration.dart'; |
11 | 12 | import 'package:vm_service/vm_service.dart'; |
12 | 13 |
|
13 | 14 | import 'fixtures/context.dart'; |
14 | 15 | import 'fixtures/project.dart'; |
15 | 16 |
|
16 | 17 | void main() { |
17 | | - final provider = TestSdkConfigurationProvider(); |
| 18 | + // set to true for debug logging. |
| 19 | + final debug = false; |
| 20 | + |
| 21 | + final provider = TestSdkConfigurationProvider(verbose: debug); |
18 | 22 | tearDownAll(provider.dispose); |
19 | 23 |
|
20 | 24 | final context = |
21 | 25 | TestContext(TestProject.testScopesWithSoundNullSafety, provider); |
22 | 26 |
|
23 | 27 | setUpAll(() async { |
24 | | - await context.setUp(); |
| 28 | + setCurrentLogWriter(debug: debug); |
| 29 | + await context.setUp(verboseCompiler: debug); |
25 | 30 | }); |
26 | 31 |
|
27 | 32 | tearDownAll(() async { |
28 | 33 | await context.tearDown(); |
29 | 34 | }); |
30 | 35 |
|
31 | | - group('ddcTemporaryVariableRegExp', () { |
32 | | - test('matches correctly', () { |
33 | | - expect(ddcTemporaryVariableRegExp.hasMatch(r't4$'), isTrue); |
34 | | - expect(ddcTemporaryVariableRegExp.hasMatch(r't4$0'), isTrue); |
35 | | - expect(ddcTemporaryVariableRegExp.hasMatch(r't4$10'), isTrue); |
36 | | - expect(ddcTemporaryVariableRegExp.hasMatch(r't4$0'), isTrue); |
37 | | - expect(ddcTemporaryVariableRegExp.hasMatch(r't1'), isTrue); |
38 | | - expect(ddcTemporaryVariableRegExp.hasMatch(r't10'), isTrue); |
39 | | - expect(ddcTemporaryVariableRegExp.hasMatch(r'__t$TL'), isTrue); |
40 | | - expect(ddcTemporaryVariableRegExp.hasMatch(r'__t$StringN'), isTrue); |
41 | | - expect(ddcTemporaryVariableRegExp.hasMatch(r'__t$IdentityMapOfString$T'), |
| 36 | + group('temporary variable regular expression', () { |
| 37 | + setUpAll(() => setCurrentLogWriter(debug: debug)); |
| 38 | + test('matches correctly for pre-patterns temporary variables', () { |
| 39 | + expect(previousDdcTemporaryVariableRegExp.hasMatch(r't4$'), isTrue); |
| 40 | + expect(previousDdcTemporaryVariableRegExp.hasMatch(r't4$0'), isTrue); |
| 41 | + expect(previousDdcTemporaryVariableRegExp.hasMatch(r't4$10'), isTrue); |
| 42 | + expect(previousDdcTemporaryVariableRegExp.hasMatch(r't4$0'), isTrue); |
| 43 | + expect(previousDdcTemporaryVariableRegExp.hasMatch(r't1'), isTrue); |
| 44 | + expect(previousDdcTemporaryVariableRegExp.hasMatch(r't10'), isTrue); |
| 45 | + expect(previousDdcTemporaryVariableRegExp.hasMatch(r'__t$TL'), isTrue); |
| 46 | + expect( |
| 47 | + previousDdcTemporaryVariableRegExp.hasMatch(r'__t$StringN'), isTrue); |
| 48 | + expect( |
| 49 | + previousDdcTemporaryVariableRegExp |
| 50 | + .hasMatch(r'__t$IdentityMapOfString$T'), |
| 51 | + isTrue); |
| 52 | + |
| 53 | + expect(previousDdcTemporaryVariableRegExp.hasMatch(r't'), isFalse); |
| 54 | + expect(previousDdcTemporaryVariableRegExp.hasMatch(r't10foo'), isFalse); |
| 55 | + expect(previousDdcTemporaryVariableRegExp.hasMatch(r't$10foo'), isFalse); |
| 56 | + }); |
| 57 | + |
| 58 | + test('matches correctly for post-patterns temporary variables', () { |
| 59 | + expect(ddcTemporaryVariableRegExp.hasMatch(r't$364$'), isTrue); |
| 60 | + expect(ddcTemporaryVariableRegExp.hasMatch(r't$364$0'), isTrue); |
| 61 | + expect(ddcTemporaryVariableRegExp.hasMatch(r't$364$10'), isTrue); |
| 62 | + expect(ddcTemporaryVariableRegExp.hasMatch(r't$364$0'), isTrue); |
| 63 | + expect(ddcTemporaryVariableRegExp.hasMatch(r't$361'), isTrue); |
| 64 | + expect(ddcTemporaryVariableRegExp.hasMatch(r't$36$350$350'), isTrue); |
| 65 | + expect( |
| 66 | + ddcTemporaryVariableRegExp.hasMatch(r't$36$350$354$35isSet'), isTrue); |
| 67 | + expect(ddcTemporaryTypeVariableRegExp.hasMatch(r'__t$TL'), isTrue); |
| 68 | + expect(ddcTemporaryTypeVariableRegExp.hasMatch(r'__t$StringN'), isTrue); |
| 69 | + expect( |
| 70 | + ddcTemporaryTypeVariableRegExp.hasMatch(r'__t$IdentityMapOfString$T'), |
42 | 71 | isTrue); |
43 | 72 |
|
44 | 73 | expect(ddcTemporaryVariableRegExp.hasMatch(r't'), isFalse); |
| 74 | + expect(ddcTemporaryVariableRegExp.hasMatch(r'this'), isFalse); |
| 75 | + expect(ddcTemporaryVariableRegExp.hasMatch(r'\$this'), isFalse); |
| 76 | + expect(ddcTemporaryVariableRegExp.hasMatch(r't10'), isFalse); |
45 | 77 | expect(ddcTemporaryVariableRegExp.hasMatch(r't10foo'), isFalse); |
46 | | - expect(ddcTemporaryVariableRegExp.hasMatch(r't$10foo'), isFalse); |
| 78 | + expect(ddcTemporaryVariableRegExp.hasMatch(r'ten'), isFalse); |
47 | 79 | }); |
48 | 80 | }); |
49 | 81 |
|
@@ -109,6 +141,8 @@ void main() { |
109 | 141 | }; |
110 | 142 | } |
111 | 143 |
|
| 144 | + setUpAll(() => setCurrentLogWriter(debug: debug)); |
| 145 | + |
112 | 146 | setUp(() async { |
113 | 147 | service = context.service; |
114 | 148 | vm = await service.getVM(); |
|
0 commit comments