diff --git a/tests/dartdevc/hot_restart_expando_test.dart b/tests/dartdevc/hot_restart_expando_test.dart new file mode 100644 index 00000000000..4802a52423f --- /dev/null +++ b/tests/dartdevc/hot_restart_expando_test.dart @@ -0,0 +1,30 @@ +// Copyright (c) 2019, 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:_runtime' as dart; + +import 'package:expect/expect.dart'; +import 'package:js/js.dart'; + +final e = Expando(); + +@JS() +external void eval(String s); + +@JS() +external Object get singleton; + +void main() { + eval(''' + if (!self.singleton) { + self.singleton = {}; + } + '''); + var o = singleton; + Expect.equals(null, e[o]); + e[o] = 1; + + dart.hotRestart(); + Expect.equals(null, e[o]); +} diff --git a/tests/dartdevc_2/hot_restart_expando_test.dart b/tests/dartdevc_2/hot_restart_expando_test.dart new file mode 100644 index 00000000000..4802a52423f --- /dev/null +++ b/tests/dartdevc_2/hot_restart_expando_test.dart @@ -0,0 +1,30 @@ +// Copyright (c) 2019, 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:_runtime' as dart; + +import 'package:expect/expect.dart'; +import 'package:js/js.dart'; + +final e = Expando(); + +@JS() +external void eval(String s); + +@JS() +external Object get singleton; + +void main() { + eval(''' + if (!self.singleton) { + self.singleton = {}; + } + '''); + var o = singleton; + Expect.equals(null, e[o]); + e[o] = 1; + + dart.hotRestart(); + Expect.equals(null, e[o]); +}