blob: df4f43a731e3059e06c593639fc85a1e43aadf5b [file] [log] [blame]
// Copyright (c) 2024, 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';
var value = "unused";
Future<void> main() async {
// Declare an unreferenced lazy static field.
Expect.equals(0, hotReloadGeneration);
await hotReload();
// The lazy static field changes value but remains unread.
Expect.equals(1, hotReloadGeneration);
await hotReload();
// The lazy static is now read and contains the updated value.
Expect.equals(2, hotReloadGeneration);
Expect.equals("before", value);
await hotReload();
// The lazy static is updated and read but retains the old value.
Expect.equals(3, hotReloadGeneration);
Expect.equals("before", value);
}