mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:06:59 +00:00
4eda30c5c2
Change-Id: I5bacd28d806661b9190d4b097955263a56f19a4d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128110 Auto-Submit: Bob Nystrom <rnystrom@google.com> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com> Commit-Queue: Bob Nystrom <rnystrom@google.com>
25 lines
712 B
Dart
25 lines
712 B
Dart
// 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.
|
|
|
|
// Regression test for https://github.com/flutter/flutter/issues/29007
|
|
|
|
String escape(String string) {
|
|
var regex = new RegExp("(\\?|\\\$|\\*|\\(|\\)|\\[)|\\+|\\.|\\\\");
|
|
return string.replaceAllMapped(
|
|
regex, (Match m) => "\\" + string.substring(m.start, m.end));
|
|
}
|
|
|
|
main() {
|
|
var text = """
|
|
Yet but three? Come one more.
|
|
Two of both kinds make up four.
|
|
""";
|
|
var accumulate = 0;
|
|
for (var i = 0; i < 65536; i++) {
|
|
accumulate += escape(text).length;
|
|
}
|
|
|
|
print(accumulate);
|
|
}
|