[tests] Porting top level deleted member tests to the hot reload framework
Change-Id: Ic3561614b75b63556ea91b5a4dd75421cc5d3d5e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411084 Reviewed-by: Nate Biggs <natebiggs@google.com> Commit-Queue: Mark Zhou <markzipan@google.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// 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:
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2704
|
||||
|
||||
var retained;
|
||||
|
||||
deleted() {
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
helper() {
|
||||
retained = () => deleted();
|
||||
return retained();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
await hotReload();
|
||||
|
||||
Expect.equals('hello', helper());
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// 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:
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2704
|
||||
|
||||
var retained;
|
||||
|
||||
deleted<A, B, C>() {
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
helper() {
|
||||
return retained();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
await hotReload();
|
||||
|
||||
Expect.equals('hello', helper());
|
||||
}
|
||||
|
||||
/** DIFF **/
|
||||
/*
|
||||
|
||||
var retained;
|
||||
|
||||
-deleted() {
|
||||
+deleted<A, B, C>() {
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
helper() {
|
||||
- retained = () => deleted();
|
||||
return retained();
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -21,11 +21,10 @@ helper() {
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
Expect.equals(0, hotReloadGeneration);
|
||||
|
||||
await hotReload();
|
||||
|
||||
Expect.contains('NoSuchMethodError', helper());
|
||||
Expect.contains('deleted', helper());
|
||||
Expect.equals(1, hotReloadGeneration);
|
||||
Expect.throws<NoSuchMethodError>(
|
||||
helper,
|
||||
(error) => error.toString().contains('deleted'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,22 +11,17 @@ import 'package:reload_test/reload_test_utils.dart';
|
||||
var retained;
|
||||
|
||||
helper() {
|
||||
try {
|
||||
return retained();
|
||||
} catch (e) {
|
||||
return e.toString();
|
||||
}
|
||||
return retained();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
Expect.equals(0, hotReloadGeneration);
|
||||
|
||||
await hotReload();
|
||||
|
||||
Expect.contains('NoSuchMethodError', helper());
|
||||
Expect.contains('deleted', helper());
|
||||
Expect.equals(1, hotReloadGeneration);
|
||||
Expect.throws<NoSuchMethodError>(
|
||||
helper,
|
||||
(error) => error.toString().contains('deleted'),
|
||||
);
|
||||
}
|
||||
|
||||
/** DIFF **/
|
||||
@@ -42,13 +37,7 @@ Future<void> main() async {
|
||||
|
||||
helper() {
|
||||
- retained = () => deleted();
|
||||
- return retained();
|
||||
+ try {
|
||||
+ return retained();
|
||||
+ } catch (e) {
|
||||
+ return e.toString();
|
||||
+ }
|
||||
return retained();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
*/
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"exclude": []
|
||||
}
|
||||
@@ -21,11 +21,10 @@ helper() {
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
Expect.equals(0, hotReloadGeneration);
|
||||
|
||||
await hotReload();
|
||||
|
||||
Expect.contains('NoSuchMethodError', helper());
|
||||
Expect.contains('deleted', helper());
|
||||
Expect.equals(1, hotReloadGeneration);
|
||||
Expect.throws<NoSuchMethodError>(
|
||||
helper,
|
||||
(error) => error.toString().contains('deleted'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,22 +15,17 @@ deleted(newParameter) {
|
||||
var retained;
|
||||
|
||||
helper() {
|
||||
try {
|
||||
return retained();
|
||||
} catch (e) {
|
||||
return e.toString();
|
||||
}
|
||||
return retained();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
Expect.equals(0, hotReloadGeneration);
|
||||
|
||||
await hotReload();
|
||||
|
||||
Expect.contains('NoSuchMethodError', helper());
|
||||
Expect.contains('deleted', helper());
|
||||
Expect.equals(1, hotReloadGeneration);
|
||||
Expect.throws<NoSuchMethodError>(
|
||||
helper,
|
||||
(error) => error.toString().contains('deleted'),
|
||||
);
|
||||
}
|
||||
|
||||
/** DIFF **/
|
||||
@@ -47,13 +42,7 @@ Future<void> main() async {
|
||||
|
||||
helper() {
|
||||
- retained = () => deleted();
|
||||
- return retained();
|
||||
+ try {
|
||||
+ return retained();
|
||||
+ } catch (e) {
|
||||
+ return e.toString();
|
||||
+ }
|
||||
return retained();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// 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:
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2794
|
||||
|
||||
var retained;
|
||||
first(flag) {
|
||||
if (flag) throw 'first!';
|
||||
}
|
||||
|
||||
deleted(_) {
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
helper() {
|
||||
retained = (bool flag) => deleted(first(flag));
|
||||
return retained(false);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
await hotReload();
|
||||
|
||||
Expect.throws(helper, (error) => error.toString().contains('first!'));
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// 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:
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2794
|
||||
|
||||
var retained;
|
||||
first(flag) {
|
||||
if (flag) throw 'first!';
|
||||
}
|
||||
|
||||
helper() {
|
||||
return retained(true);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
await hotReload();
|
||||
|
||||
Expect.throws(helper, (error) => error.toString().contains('first!'));
|
||||
}
|
||||
|
||||
/** DIFF **/
|
||||
/*
|
||||
if (flag) throw 'first!';
|
||||
}
|
||||
|
||||
-deleted(_) {
|
||||
- return 'hello';
|
||||
-}
|
||||
-
|
||||
helper() {
|
||||
- retained = (bool flag) => deleted(first(flag));
|
||||
- return retained(false);
|
||||
+ return retained(true);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
*/
|
||||
@@ -0,0 +1,31 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// 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:
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2825
|
||||
|
||||
import 'test-lib.dart';
|
||||
|
||||
var retained;
|
||||
helper() {
|
||||
retained = () => deleted();
|
||||
return retained();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
await hotReload();
|
||||
|
||||
// VM: What actually happens because we don't re-search imported libraries.
|
||||
Expect.equals('hello', helper());
|
||||
|
||||
// VM: What should happen and what did happen with the old VM frontend:
|
||||
// Expect.throws<NoSuchMethodError>(
|
||||
// helper,
|
||||
// (error) => error.toString().contains('deleted'),
|
||||
// );
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// 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:
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2825
|
||||
|
||||
var retained;
|
||||
helper() {
|
||||
return retained();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
await hotReload();
|
||||
|
||||
// VM: What actually happens because we don't re-search imported libraries.
|
||||
Expect.equals('hello', helper());
|
||||
|
||||
// VM: What should happen and what did happen with the old VM frontend:
|
||||
// Expect.throws<NoSuchMethodError>(
|
||||
// helper,
|
||||
// (error) => error.toString().contains('deleted'),
|
||||
// );
|
||||
}
|
||||
|
||||
/** DIFF **/
|
||||
/*
|
||||
// Adapted from:
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2825
|
||||
|
||||
-import 'test-lib.dart';
|
||||
-
|
||||
var retained;
|
||||
helper() {
|
||||
- retained = () => deleted();
|
||||
return retained();
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,3 @@
|
||||
deleted() {
|
||||
return 'hello';
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// 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:
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2889
|
||||
|
||||
var retained;
|
||||
get deleted {
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
helper() {
|
||||
retained = () => deleted;
|
||||
return retained();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
await hotReload();
|
||||
|
||||
Expect.throws<NoSuchMethodError>(
|
||||
helper,
|
||||
(error) => error.toString().contains('deleted'),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// 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:
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2889
|
||||
|
||||
var retained;
|
||||
helper() {
|
||||
return retained();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
await hotReload();
|
||||
|
||||
Expect.throws<NoSuchMethodError>(
|
||||
helper,
|
||||
(error) => error.toString().contains('deleted'),
|
||||
);
|
||||
}
|
||||
|
||||
/** DIFF **/
|
||||
/*
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2889
|
||||
|
||||
var retained;
|
||||
-get deleted {
|
||||
- return 'hello';
|
||||
-}
|
||||
-
|
||||
helper() {
|
||||
- retained = () => deleted;
|
||||
return retained();
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// 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:
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2764
|
||||
|
||||
var retained;
|
||||
deleted<A, B, C>() {
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
helper() {
|
||||
retained = () => deleted<int, int, int>();
|
||||
return retained();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
await hotReload();
|
||||
|
||||
Expect.throws<NoSuchMethodError>(
|
||||
helper,
|
||||
(error) => error.toString().contains('deleted'),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// 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:
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2764
|
||||
|
||||
var retained;
|
||||
|
||||
helper() {
|
||||
return retained();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
await hotReload();
|
||||
|
||||
Expect.throws<NoSuchMethodError>(
|
||||
helper,
|
||||
(error) => error.toString().contains('deleted'),
|
||||
);
|
||||
}
|
||||
|
||||
/** DIFF **/
|
||||
/*
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2764
|
||||
|
||||
var retained;
|
||||
-deleted<A, B, C>() {
|
||||
- return 'hello';
|
||||
-}
|
||||
|
||||
helper() {
|
||||
- retained = () => deleted<int, int, int>();
|
||||
return retained();
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// 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:
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2733
|
||||
|
||||
var retained;
|
||||
deleted<A, B, C>() {
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
helper() {
|
||||
retained = () => deleted<int, int, int>();
|
||||
return retained();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
await hotReload();
|
||||
|
||||
Expect.throws<NoSuchMethodError>(
|
||||
helper,
|
||||
(error) => error.toString().contains('deleted'),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// 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:
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2733
|
||||
|
||||
var retained;
|
||||
deleted() {
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
helper() {
|
||||
return retained();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
await hotReload();
|
||||
|
||||
Expect.throws<NoSuchMethodError>(
|
||||
helper,
|
||||
(error) => error.toString().contains('deleted'),
|
||||
);
|
||||
}
|
||||
|
||||
/** DIFF **/
|
||||
/*
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2733
|
||||
|
||||
var retained;
|
||||
-deleted<A, B, C>() {
|
||||
+deleted() {
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
helper() {
|
||||
- retained = () => deleted<int, int, int>();
|
||||
return retained();
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// 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:
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2919
|
||||
|
||||
var retained;
|
||||
set deleted(x) {}
|
||||
helper() {
|
||||
retained = () => deleted = 'hello';
|
||||
return retained();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
await hotReload();
|
||||
|
||||
Expect.throws<NoSuchMethodError>(
|
||||
helper,
|
||||
(error) => error.toString().contains('deleted'),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// 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:
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2919
|
||||
|
||||
var retained;
|
||||
helper() {
|
||||
return retained();
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
await hotReload();
|
||||
|
||||
Expect.throws<NoSuchMethodError>(
|
||||
helper,
|
||||
(error) => error.toString().contains('deleted'),
|
||||
);
|
||||
}
|
||||
|
||||
/** DIFF **/
|
||||
/*
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2919
|
||||
|
||||
var retained;
|
||||
-set deleted(x) {}
|
||||
helper() {
|
||||
- retained = () => deleted = 'hello';
|
||||
return retained();
|
||||
}
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// 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:
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2949
|
||||
|
||||
var retained;
|
||||
|
||||
first(flag) {
|
||||
if (flag) throw 'first!';
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
set deleted(x) {}
|
||||
|
||||
helper() {
|
||||
retained = (bool flag) => deleted = first(flag);
|
||||
return retained(false);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
await hotReload();
|
||||
|
||||
Expect.throws(helper, (error) => error.toString().contains('first!'));
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// 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:
|
||||
// https://github.com/dart-lang/sdk/blob/13f5fc6b168d8b6e5843d17fb9ba77f1343a7dfe/runtime/vm/isolate_reload_test.cc#L2949
|
||||
|
||||
var retained;
|
||||
|
||||
first(flag) {
|
||||
if (flag) throw 'first!';
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
helper() {
|
||||
return retained(true);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
Expect.equals('hello', helper());
|
||||
await hotReload();
|
||||
|
||||
Expect.throws(helper, (error) => error.toString().contains('first!'));
|
||||
}
|
||||
|
||||
/** DIFF **/
|
||||
/*
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
-set deleted(x) {}
|
||||
-
|
||||
helper() {
|
||||
- retained = (bool flag) => deleted = first(flag);
|
||||
- return retained(false);
|
||||
+ return retained(true);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
*/
|
||||
Reference in New Issue
Block a user