mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 05:36:49 +00:00
1c5e12c212
The `int.parse()` function would - if radix is provided and not 10 - use functions that `unsafeCast<StringBase>()`. => The string can be a JSString. Issue https://github.com/dart-lang/sdk/issues/54800 CoreLibraryReviewExempt: Adding test that should pass on all backends. Change-Id: Ie6efa5bc545cadce5ea946e2c1d732b2cf94e306 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350303 Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com>
12 lines
431 B
Dart
12 lines
431 B
Dart
// Copyright (c) 2024, 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';
|
|
|
|
void main() {
|
|
final match = RegExp(r' ([0-9]+) ').allMatches(' 1234 ').single;
|
|
print(match[1]!.runtimeType);
|
|
Expect.equals(0x1234, int.parse(match[1]!, radix: 16));
|
|
}
|