Skip to content

Commit

Permalink
[ddc] Port library show/hide hot reload tests
Browse files Browse the repository at this point in the history
Change-Id: Iaa7ef742f1204c73e96738cdba774f1263b32797
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405061
Commit-Queue: Nicholas Shahan <[email protected]>
Reviewed-by: Nate Biggs <[email protected]>
Reviewed-by: Mark Zhou <[email protected]>
  • Loading branch information
nshahan authored and Commit Queue committed Jan 22, 2025
1 parent 1a48649 commit 5ec1002
Show file tree
Hide file tree
Showing 16 changed files with 326 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/hot_reload/library_hide/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"expectedErrors": {
"1": "Error: Method not found: 'importedFunc'."
}
}
5 changes: 5 additions & 0 deletions tests/hot_reload/library_hide/lib1.0.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// 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.

importedFunc() => 'a';
9 changes: 9 additions & 0 deletions tests/hot_reload/library_hide/lib1.1.reject.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// 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.

importedFunc() => 'a';

/** DIFF **/
/*
*/
9 changes: 9 additions & 0 deletions tests/hot_reload/library_hide/lib1.2.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// 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.

importedFunc() => 'a';

/** DIFF **/
/*
*/
19 changes: 19 additions & 0 deletions tests/hot_reload/library_hide/main.0.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// 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/9f465e5b6eab0dc3af96140189d4f0190e0ff925/runtime/vm/isolate_reload_test.cc#L1123

void helper() {}

Future<void> main() async {
helper();
await hotReload(expectRejection: true);
helper();
await hotReload();
helper();
}
43 changes: 43 additions & 0 deletions tests/hot_reload/library_hide/main.1.reject.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// 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';

import 'lib1.dart' hide importedFunc;

// Adapted from:
// https://github.com/dart-lang/sdk/blob/9f465e5b6eab0dc3af96140189d4f0190e0ff925/runtime/vm/isolate_reload_test.cc#L1123

void helper() {
Expect.equals('a', importedFunc());
}

Future<void> main() async {
helper();
await hotReload(expectRejection: true);
helper();
await hotReload();
helper();
}

/** DIFF **/
/*
@@ -5,10 +5,14 @@
import 'package:expect/expect.dart';
import 'package:reload_test/reload_test_utils.dart';
+import 'lib1.dart' hide importedFunc;
+
// Adapted from:
// https://github.com/dart-lang/sdk/blob/9f465e5b6eab0dc3af96140189d4f0190e0ff925/runtime/vm/isolate_reload_test.cc#L1123
-void helper() {}
+void helper() {
+ Expect.equals('a', importedFunc());
+}
Future<void> main() async {
helper();
*/
36 changes: 36 additions & 0 deletions tests/hot_reload/library_hide/main.2.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// 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';

import 'lib1.dart';

// Adapted from:
// https://github.com/dart-lang/sdk/blob/9f465e5b6eab0dc3af96140189d4f0190e0ff925/runtime/vm/isolate_reload_test.cc#L1123

void helper() {
Expect.equals('a', importedFunc());
}

Future<void> main() async {
helper();
await hotReload(expectRejection: true);
helper();
await hotReload();
helper();
}

/** DIFF **/
/*
@@ -5,7 +5,7 @@
import 'package:expect/expect.dart';
import 'package:reload_test/reload_test_utils.dart';
-import 'lib1.dart' hide importedFunc;
+import 'lib1.dart';
// Adapted from:
// https://github.com/dart-lang/sdk/blob/9f465e5b6eab0dc3af96140189d4f0190e0ff925/runtime/vm/isolate_reload_test.cc#L1123
*/
6 changes: 6 additions & 0 deletions tests/hot_reload/library_show/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"expectedErrors": {
"1": "Error: Method not found: 'importedFunc'.",
"2": "Error: Method not found: 'importedIntFunc'."
}
}
9 changes: 9 additions & 0 deletions tests/hot_reload/library_show/lib1.0.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// 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.

// Adapted from:
// https://github.com/dart-lang/sdk/blob/9f465e5b6eab0dc3af96140189d4f0190e0ff925/runtime/vm/isolate_reload_test.cc#L1153

importedFunc() => 'a';
importedIntFunc() => 4;
13 changes: 13 additions & 0 deletions tests/hot_reload/library_show/lib1.1.reject.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// 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.

// Adapted from:
// https://github.com/dart-lang/sdk/blob/9f465e5b6eab0dc3af96140189d4f0190e0ff925/runtime/vm/isolate_reload_test.cc#L1153

importedFunc() => 'a';
importedIntFunc() => 4;

/** DIFF **/
/*
*/
13 changes: 13 additions & 0 deletions tests/hot_reload/library_show/lib1.2.reject.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// 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.

// Adapted from:
// https://github.com/dart-lang/sdk/blob/9f465e5b6eab0dc3af96140189d4f0190e0ff925/runtime/vm/isolate_reload_test.cc#L1153

importedFunc() => 'a';
importedIntFunc() => 4;

/** DIFF **/
/*
*/
13 changes: 13 additions & 0 deletions tests/hot_reload/library_show/lib1.3.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// 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.

// Adapted from:
// https://github.com/dart-lang/sdk/blob/9f465e5b6eab0dc3af96140189d4f0190e0ff925/runtime/vm/isolate_reload_test.cc#L1153

importedFunc() => 'a';
importedIntFunc() => 4;

/** DIFF **/
/*
*/
25 changes: 25 additions & 0 deletions tests/hot_reload/library_show/main.0.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// 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';

import 'lib1.dart' show importedIntFunc;

// Adapted from:
// https://github.com/dart-lang/sdk/blob/9f465e5b6eab0dc3af96140189d4f0190e0ff925/runtime/vm/isolate_reload_test.cc#L1153

void helper() {
Expect.equals(4, importedIntFunc());
}

Future<void> main() async {
helper();
await hotReload(expectRejection: true);
helper();
await hotReload(expectRejection: true);
helper();
await hotReload();
helper();
}
38 changes: 38 additions & 0 deletions tests/hot_reload/library_show/main.1.reject.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// 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';

import 'lib1.dart' show importedIntFunc;

// Adapted from:
// https://github.com/dart-lang/sdk/blob/9f465e5b6eab0dc3af96140189d4f0190e0ff925/runtime/vm/isolate_reload_test.cc#L1153

void helper() {
Expect.equals(4, importedFunc());
}

Future<void> main() async {
helper();
await hotReload(expectRejection: true);
helper();
await hotReload(expectRejection: true);
helper();
await hotReload();
helper();
}

/** DIFF **/
/*
@@ -11,7 +11,7 @@
// https://github.com/dart-lang/sdk/blob/9f465e5b6eab0dc3af96140189d4f0190e0ff925/runtime/vm/isolate_reload_test.cc#L1153
void helper() {
- Expect.equals(4, importedIntFunc());
+ Expect.equals(4, importedFunc());
}
Future<void> main() async {
*/
45 changes: 45 additions & 0 deletions tests/hot_reload/library_show/main.2.reject.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// 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';

import 'lib1.dart' show importedFunc;

// Adapted from:
// https://github.com/dart-lang/sdk/blob/9f465e5b6eab0dc3af96140189d4f0190e0ff925/runtime/vm/isolate_reload_test.cc#L1153

void helper() {
Expect.equals(4, importedIntFunc());
}

Future<void> main() async {
helper();
await hotReload(expectRejection: true);
helper();
await hotReload(expectRejection: true);
helper();
await hotReload();
helper();
}

/** DIFF **/
/*
@@ -5,13 +5,13 @@
import 'package:expect/expect.dart';
import 'package:reload_test/reload_test_utils.dart';
-import 'lib1.dart' show importedIntFunc;
+import 'lib1.dart' show importedFunc;
// Adapted from:
// https://github.com/dart-lang/sdk/blob/9f465e5b6eab0dc3af96140189d4f0190e0ff925/runtime/vm/isolate_reload_test.cc#L1153
void helper() {
- Expect.equals(4, importedFunc());
+ Expect.equals(4, importedIntFunc());
}
Future<void> main() async {
*/
38 changes: 38 additions & 0 deletions tests/hot_reload/library_show/main.3.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// 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';

import 'lib1.dart' show importedFunc;

// Adapted from:
// https://github.com/dart-lang/sdk/blob/9f465e5b6eab0dc3af96140189d4f0190e0ff925/runtime/vm/isolate_reload_test.cc#L1153

void helper() {
Expect.equals('a', importedFunc());
}

Future<void> main() async {
helper();
await hotReload(expectRejection: true);
helper();
await hotReload(expectRejection: true);
helper();
await hotReload();
helper();
}

/** DIFF **/
/*
@@ -11,7 +11,7 @@
// https://github.com/dart-lang/sdk/blob/9f465e5b6eab0dc3af96140189d4f0190e0ff925/runtime/vm/isolate_reload_test.cc#L1153
void helper() {
- Expect.equals(4, importedIntFunc());
+ Expect.equals('a', importedFunc());
}
Future<void> main() async {
*/

0 comments on commit 5ec1002

Please sign in to comment.