Skip to content

Commit 16960a8

Browse files
nshahanCommit Queue
authored andcommitted
[tests] Fix tests for changing type parameters
* Handle inconsistencies in the type of a notice in reload reports. * Update expected error messages when the type parameters of a class change. * Fail reload tests if rejection error was expected but the actual error is null. * Cleanup unused imports in tests. * Delete change_instance_format7 test because it was split into DDC and VM specific versions. Change-Id: I3b4d6cb3126d7c1fad688c393677e053a005687f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408883 Reviewed-by: Mark Zhou <[email protected]> Commit-Queue: Nicholas Shahan <[email protected]>
1 parent 9e8a21b commit 16960a8

File tree

15 files changed

+9
-75
lines changed

15 files changed

+9
-75
lines changed

pkg/dev_compiler/test/hot_reload_suite.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ abstract class HotReloadSuiteRunner {
752752
return false;
753753
}
754754
final rejectionMessage = reloadReceipt.rejectionMessage;
755-
if (rejectionMessage != null &&
755+
if (rejectionMessage == null ||
756756
!rejectionMessage.contains(expectedError)) {
757757
_print(
758758
'Generation ${reloadReceipt.generation} was rejected but error '

pkg/reload_test/lib/src/_vm_reload_utils.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ extension on ReloadReport {
179179
final notices = this.json?['notices'] as List?;
180180
if (notices != null) {
181181
for (final notice in notices) {
182-
if (notice['type'] == 'ReasonForCancelling') {
182+
if (notice['type'] == 'ReasonForCancelling' ||
183+
notice['type'] == 'ReasonForCancellingReload') {
183184
return notice['message'] as String?;
184185
}
185186
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"expectedErrors": {
3-
"1": "type parameters have changed"
3+
"1": "Limitation: changing type parameters does not work with hot reload."
44
}
55
}
6-

tests/hot_reload/change_instance_format6/main.0.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
import 'package:expect/expect.dart';
65
import 'package:reload_test/reload_test_utils.dart';
76

87
// Adapted from:

tests/hot_reload/change_instance_format6/main.1.reject.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
import 'package:expect/expect.dart';
65
import 'package:reload_test/reload_test_utils.dart';
76

87
// Adapted from:

tests/hot_reload/change_instance_format7/main.0.dart

Lines changed: 0 additions & 23 deletions
This file was deleted.

tests/hot_reload/change_instance_format7/main.1.dart

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
2-
"exclude": ["vm"],
2+
"exclude": [
3+
"vm"
4+
],
35
"expectedErrors": {
4-
"1": "type parameters have changed"
6+
"1": "Limitation: changing type parameters does not work with hot reload."
57
}
68
}

tests/hot_reload/change_instance_format7_ddc/main.0.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
import 'package:expect/expect.dart';
65
import 'package:reload_test/reload_test_utils.dart';
76

87
// Adapted from:

tests/hot_reload/change_instance_format7_ddc/main.1.reject.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
import 'package:expect/expect.dart';
65
import 'package:reload_test/reload_test_utils.dart';
76

87
// Adapted from:

0 commit comments

Comments
 (0)