| // Copyright (c) 2023, 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:js_interop'; | |
| import 'package:expect/expect.dart'; | |
| @JS() | |
| external void eval(String code); | |
| @JS() | |
| external String get jsString; | |
| void main() { | |
| eval(r''' | |
| globalThis.jsString = "hi"; | |
| '''); | |
| switch (jsString) { | |
| case "hi": | |
| break; | |
| default: | |
| Expect.fail("Unexpected JS String: $jsString"); | |
| } | |
| } |