|
| 1 | +// Copyright (c) 2025, 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/be2aabd91c67f7f331c49cb74e18fe5e469f04db/runtime/vm/isolate_reload_test.cc#L2085 |
| 10 | + |
| 11 | +enum Fruit { Apple, Cantaloupe, Banana } |
| 12 | + |
| 13 | +void helper() { |
| 14 | + Expect.equals(1, Fruit.Cantaloupe.index); |
| 15 | + Expect.equals('Fruit.Cantaloupe', Fruit.Cantaloupe.toString()); |
| 16 | +} |
| 17 | + |
| 18 | +Future<void> main() async { |
| 19 | + Expect.equals(0, Fruit.Apple.index); |
| 20 | + Expect.equals('Fruit.Apple', Fruit.Apple.toString()); |
| 21 | + Expect.equals(1, Fruit.Banana.index); |
| 22 | + Expect.equals('Fruit.Banana', Fruit.Banana.toString()); |
| 23 | + await hotReload(); |
| 24 | + |
| 25 | + Expect.equals(0, Fruit.Apple.index); |
| 26 | + Expect.equals('Fruit.Apple', Fruit.Apple.toString()); |
| 27 | + Expect.equals(2, Fruit.Banana.index); |
| 28 | + Expect.equals('Fruit.Banana', Fruit.Banana.toString()); |
| 29 | + helper(); |
| 30 | +} |
| 31 | + |
| 32 | +/** DIFF **/ |
| 33 | +/* |
| 34 | +@@ -8,9 +8,12 @@ |
| 35 | + // Adapted from: |
| 36 | + // https://github.com/dart-lang/sdk/blob/be2aabd91c67f7f331c49cb74e18fe5e469f04db/runtime/vm/isolate_reload_test.cc#L2085 |
| 37 | + |
| 38 | +-enum Fruit { Apple, Banana } |
| 39 | ++enum Fruit { Apple, Cantaloupe, Banana } |
| 40 | + |
| 41 | +-void helper() {} |
| 42 | ++void helper() { |
| 43 | ++ Expect.equals(1, Fruit.Cantaloupe.index); |
| 44 | ++ Expect.equals('Fruit.Cantaloupe', Fruit.Cantaloupe.toString()); |
| 45 | ++} |
| 46 | + |
| 47 | + Future<void> main() async { |
| 48 | + Expect.equals(0, Fruit.Apple.index); |
| 49 | +@@ -25,3 +28,4 @@ |
| 50 | + Expect.equals('Fruit.Banana', Fruit.Banana.toString()); |
| 51 | + helper(); |
| 52 | + } |
| 53 | ++ |
| 54 | +*/ |
0 commit comments