Skip to content

Commit

Permalink
[tests] Fix tests for changing type parameters
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
nshahan authored and Commit Queue committed Feb 11, 2025
1 parent 9e8a21b commit 16960a8
Show file tree
Hide file tree
Showing 15 changed files with 9 additions and 75 deletions.
2 changes: 1 addition & 1 deletion pkg/dev_compiler/test/hot_reload_suite.dart
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ abstract class HotReloadSuiteRunner {
return false;
}
final rejectionMessage = reloadReceipt.rejectionMessage;
if (rejectionMessage != null &&
if (rejectionMessage == null ||
!rejectionMessage.contains(expectedError)) {
_print(
'Generation ${reloadReceipt.generation} was rejected but error '
Expand Down
3 changes: 2 additions & 1 deletion pkg/reload_test/lib/src/_vm_reload_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ extension on ReloadReport {
final notices = this.json?['notices'] as List?;
if (notices != null) {
for (final notice in notices) {
if (notice['type'] == 'ReasonForCancelling') {
if (notice['type'] == 'ReasonForCancelling' ||
notice['type'] == 'ReasonForCancellingReload') {
return notice['message'] as String?;
}
}
Expand Down
3 changes: 1 addition & 2 deletions tests/hot_reload/change_instance_format6/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"expectedErrors": {
"1": "type parameters have changed"
"1": "Limitation: changing type parameters does not work with hot reload."
}
}

1 change: 0 additions & 1 deletion tests/hot_reload/change_instance_format6/main.0.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:expect/expect.dart';
import 'package:reload_test/reload_test_utils.dart';

// Adapted from:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:expect/expect.dart';
import 'package:reload_test/reload_test_utils.dart';

// Adapted from:
Expand Down
23 changes: 0 additions & 23 deletions tests/hot_reload/change_instance_format7/main.0.dart

This file was deleted.

36 changes: 0 additions & 36 deletions tests/hot_reload/change_instance_format7/main.1.dart

This file was deleted.

6 changes: 4 additions & 2 deletions tests/hot_reload/change_instance_format7_ddc/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"exclude": ["vm"],
"exclude": [
"vm"
],
"expectedErrors": {
"1": "type parameters have changed"
"1": "Limitation: changing type parameters does not work with hot reload."
}
}
1 change: 0 additions & 1 deletion tests/hot_reload/change_instance_format7_ddc/main.0.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:expect/expect.dart';
import 'package:reload_test/reload_test_utils.dart';

// Adapted from:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:expect/expect.dart';
import 'package:reload_test/reload_test_utils.dart';

// Adapted from:
Expand Down
1 change: 0 additions & 1 deletion tests/hot_reload/change_instance_format7_vm/main.0.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:expect/expect.dart';
import 'package:reload_test/reload_test_utils.dart';

// Adapted from:
Expand Down
1 change: 0 additions & 1 deletion tests/hot_reload/change_instance_format7_vm/main.1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:expect/expect.dart';
import 'package:reload_test/reload_test_utils.dart';

// Adapted from:
Expand Down
3 changes: 1 addition & 2 deletions tests/hot_reload/change_instance_format9/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"expectedErrors": {
"1": "type parameters have changed"
"1": "Limitation: changing type parameters does not work with hot reload."
}
}

1 change: 0 additions & 1 deletion tests/hot_reload/change_instance_format9/main.0.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:expect/expect.dart';
import 'package:reload_test/reload_test_utils.dart';

// Adapted from:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:expect/expect.dart';
import 'package:reload_test/reload_test_utils.dart';

// Adapted from:
Expand Down

0 comments on commit 16960a8

Please sign in to comment.