File tree Expand file tree Collapse file tree 4 files changed +92
-0
lines changed Expand file tree Collapse file tree 4 files changed +92
-0
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,17 @@ class Fruit {
1616
1717var x;
1818
19+ helper () {
20+ return const Fruit ('Pear' );
21+ }
22+
1923Future <void > main () async {
2024 x = const Fruit ('Pear' );
2125 Expect .equals ('Pear' , x.toString ());
26+ Expect .identical (x, helper ());
27+
2228 await hotReload ();
2329 Expect .equals ('Pear' , x.toString ());
2430 Expect .identical (x, const Fruit ('Pear' ));
31+ Expect .identical (x, helper ());
2532}
Original file line number Diff line number Diff line change @@ -16,12 +16,19 @@ class Fruit {
1616
1717var x;
1818
19+ helper () {
20+ return const Fruit ('Pear' );
21+ }
22+
1923Future <void > main () async {
2024 x = const Fruit ('Pear' );
2125 Expect .equals ('Pear' , x.toString ());
26+ Expect .identical (x, helper ());
27+
2228 await hotReload ();
2329 Expect .equals ('Pear' , x.toString ());
2430 Expect .identical (x, const Fruit ('Pear' ));
31+ Expect .identical (x, helper ());
2532}
2633/** DIFF **/
2734/*
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
2+ // for details. All rights reserved. Use of this source code is governed by a
3+ // BSD-style license that can be found in the LICENSE file.
4+
5+ import 'package:expect/expect.dart' ;
6+ import 'package:reload_test/reload_test_utils.dart' ;
7+
8+ // Adapted from:
9+ // https://github.com/dart-lang/sdk/blob/26f2ff4f11f56841fc5a250231ef7d49f01eb234/runtime/vm/isolate_reload_test.cc#L2604
10+ // Extended with logic to check for non-identity.
11+
12+ class Fruit {
13+ final String name;
14+ const Fruit (this .name);
15+ String toString () => name;
16+ }
17+
18+ var x;
19+
20+ helper () {
21+ return const Fruit ('Pear' );
22+ }
23+
24+ Future <void > main () async {
25+ x = const Fruit ('Pear' );
26+ Expect .equals ('Pear' , x.toString ());
27+ Expect .identical (x, helper ());
28+
29+ await hotReload ();
30+ Expect .equals ('Pear' , x.toString ());
31+ Expect .identical (x, const Fruit ('Pear' ));
32+ Expect .notIdentical (x, helper ());
33+ }
Original file line number Diff line number Diff line change 1+ // Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
2+ // for details. All rights reserved. Use of this source code is governed by a
3+ // BSD-style license that can be found in the LICENSE file.
4+
5+ import 'package:expect/expect.dart' ;
6+ import 'package:reload_test/reload_test_utils.dart' ;
7+
8+ // Adapted from:
9+ // https://github.com/dart-lang/sdk/blob/26f2ff4f11f56841fc5a250231ef7d49f01eb234/runtime/vm/isolate_reload_test.cc#L2604
10+ // Extended with logic to check for non-identity.
11+
12+ class Fruit {
13+ final String name;
14+ final String field = 'field' ;
15+ const Fruit (this .name);
16+ String toString () => name;
17+ }
18+
19+ var x;
20+
21+ helper () {
22+ return const Fruit ('Pear' );
23+ }
24+
25+ Future <void > main () async {
26+ x = const Fruit ('Pear' );
27+ Expect .equals ('Pear' , x.toString ());
28+ Expect .identical (x, helper ());
29+
30+ await hotReload ();
31+ Expect .equals ('Pear' , x.toString ());
32+ Expect .identical (x, const Fruit ('Pear' ));
33+ Expect .notIdentical (x, helper ());
34+ }
35+ /** DIFF **/
36+ /*
37+ @@ -11,6 +11,7 @@
38+
39+ class Fruit {
40+ final String name;
41+ + final String field = 'field';
42+ const Fruit(this.name);
43+ String toString() => name;
44+ }
45+ */
You can’t perform that action at this time.
0 commit comments