Files
sdk/tests/web/wasm/string_switch_test.dart
Mayank Patke 20056805f7 [dart2wasm] Clean up dart2wasm tests using js_util
Bug: #61550
Change-Id: I6a6a696405a6a8df62c3088fb3f7bdba2e27b783
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/450967
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2025-09-25 14:22:43 -07:00

27 lines
555 B
Dart

// 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");
}
}