Files
sdk/tests/hot_reload/change_instance_format3/main.0.dart
T
MarkZ ebbdbe4ef8 [tests] Porting instance and hierarchy change tests to the hot reload framework.
Change-Id: I7a11a43d34772f2020dda235327da71fa388f3ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406062
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-01-31 15:13:18 -08:00

39 lines
862 B
Dart

// 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/1a486499bf73ee5b007abbe522b94869a1f36d02/runtime/vm/isolate_reload_test.cc#L3908
// Tests reload succeeds when instance format changes.
// Change: Foo {a, b, c:42, d} -> Foo {c:42, g}
// Validate: c keeps the value in the retained Foo object.
class Foo<A, B> {
var a;
var b;
var c;
var d;
}
helper() {
f = Foo();
f.a = 1;
f.b = 2;
f.c = 3;
f.d = 4;
}
var f;
Future<void> main() async {
helper();
Expect.equals(3, f.c);
await hotReload();
Expect.equals(3, f.c);
}