mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 11:03:19 +00:00
b998b10f3e
Change-Id: I3a31632ce28fb87a410b759d092c7ebc9393574d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128306 Commit-Queue: Bob Nystrom <rnystrom@google.com> Auto-Submit: Bob Nystrom <rnystrom@google.com> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
49 lines
1 KiB
Dart
49 lines
1 KiB
Dart
// Copyright (c) 2013, 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";
|
|
|
|
const WHITESPACE = const [
|
|
0x09,
|
|
0x0A,
|
|
0x0B,
|
|
0x0C,
|
|
0x0D,
|
|
0x20,
|
|
0x85,
|
|
0xA0,
|
|
0x1680,
|
|
0x2000,
|
|
0x2001,
|
|
0x2002,
|
|
0x2003,
|
|
0x2004,
|
|
0x2005,
|
|
0x2006,
|
|
0x2007,
|
|
0x2008,
|
|
0x2009,
|
|
0x200A,
|
|
0x202F,
|
|
0x205F,
|
|
0x3000,
|
|
0x2028,
|
|
0x2029,
|
|
0xFEFF,
|
|
];
|
|
|
|
main() {
|
|
for (var ws in WHITESPACE) {
|
|
var name = ws.toRadixString(16);
|
|
var c = new String.fromCharCode(ws);
|
|
Expect.equals("", c.trim(), "$name");
|
|
Expect.equals("a", ("a" + c).trim(), "a-$name");
|
|
Expect.equals("a", (c + "a").trim(), "$name-a");
|
|
Expect.equals("a", (c + c + "a" + c + c).trim(), "$name around");
|
|
Expect.equals(
|
|
"a" + c + "a", (c + c + "a" + c + "a" + c + c).trim(), "$name many");
|
|
}
|
|
Expect.equals("", new String.fromCharCodes(WHITESPACE).trim(), "ALL");
|
|
}
|