8aa6b413eb
A new optional suffix to the file names is added: '.restart'. This allows us to differentiate between hot reload generations and hot restart generations. All files with the same generation should either have the suffix or don't. If present, uses the recompile-request instruction in the frontend server. If not, uses the recompile instruction. Tests are renamed and a WIP README is added to document this change. Change-Id: I2691c5ec0b7336115a76dc0e0369213e74b6ea21 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406183 Commit-Queue: Srujan Gaddam <srujzs@google.com> Reviewed-by: Nicholas Shahan <nshahan@google.com>
72 lines
1.8 KiB
Dart
72 lines
1.8 KiB
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 'dart:async';
|
|
|
|
import 'package:expect/expect.dart';
|
|
import 'package:reload_test/reload_test_utils.dart';
|
|
|
|
var x = 'Hello Bar';
|
|
|
|
Future<void> main() async {
|
|
Expect.equals('Hello Bar', x);
|
|
Expect.equals(2, hotRestartGeneration);
|
|
|
|
scheduleMicrotask(() {
|
|
Expect.equals(2, hotRestartGeneration);
|
|
});
|
|
Future<Null>.microtask(() {
|
|
throw x;
|
|
})
|
|
.catchError((e, stackTrace) {
|
|
Expect.equals("Hello Bar", e);
|
|
Expect.equals(2, hotRestartGeneration);
|
|
})
|
|
.then((_) {
|
|
Expect.equals(2, hotRestartGeneration);
|
|
});
|
|
}
|
|
|
|
/** DIFF **/
|
|
/*
|
|
import 'package:expect/expect.dart';
|
|
import 'package:reload_test/reload_test_utils.dart';
|
|
|
|
-var x = 'Hello Foo';
|
|
+var x = 'Hello Bar';
|
|
|
|
Future<void> main() async {
|
|
- Expect.equals('Hello Foo', x);
|
|
- Expect.equals(1, hotRestartGeneration);
|
|
+ Expect.equals('Hello Bar', x);
|
|
+ Expect.equals(2, hotRestartGeneration);
|
|
|
|
scheduleMicrotask(() {
|
|
- Expect.equals(1, hotRestartGeneration);
|
|
+ Expect.equals(2, hotRestartGeneration);
|
|
});
|
|
Future<Null>.microtask(() {
|
|
throw x;
|
|
})
|
|
.catchError((e, stackTrace) {
|
|
- Expect.equals("Hello Foo", e);
|
|
- Expect.equals(1, hotRestartGeneration);
|
|
+ Expect.equals("Hello Bar", e);
|
|
+ Expect.equals(2, hotRestartGeneration);
|
|
})
|
|
.then((_) {
|
|
- Expect.equals(1, hotRestartGeneration);
|
|
+ Expect.equals(2, hotRestartGeneration);
|
|
});
|
|
- Future.delayed(Duration(seconds: 5), () {
|
|
- throw Exception(
|
|
- 'Future from main.1.dart before hot restart. '
|
|
- 'This should never run.',
|
|
- );
|
|
- });
|
|
-
|
|
- await hotRestart();
|
|
}
|
|
*/
|