mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Clean up Platform.lineTerminator test.
Change-Id: I933956de806d9b4597385cf4afa4a98528c2165c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313542 Reviewed-by: Lasse Nielsen <lrn@google.com> Commit-Queue: Brian Quinlan <bquinlan@google.com>
This commit is contained in:
parent
69f95fa2cd
commit
e75cacf2b8
|
@ -30,12 +30,13 @@ test() {
|
|||
Expect.equals(Platform.isMacOS, Platform.operatingSystem == "macos");
|
||||
Expect.equals(Platform.isWindows, Platform.operatingSystem == "windows");
|
||||
Expect.equals(Platform.isAndroid, Platform.operatingSystem == "android");
|
||||
var sep = Platform.pathSeparator;
|
||||
Expect.isTrue(sep == '/' || (os == 'windows' && sep == '\\'));
|
||||
final eol = Platform.lineTerminator;
|
||||
Expect.isTrue(
|
||||
(eol == '\n' && os != 'windows') || (eol == '\r\n' && os == 'windows'),
|
||||
"unexpected line ending ${utf8.encode(eol)} on $os");
|
||||
if (Platform.isWindows) {
|
||||
Expect.equals("\r\n", Platform.lineTerminator, "windows lineTerminator");
|
||||
Expect.equals("\\", Platform.pathSeparator, "$os path-seperator");
|
||||
} else {
|
||||
Expect.equals("\n", Platform.lineTerminator, "$os lineTerminator");
|
||||
Expect.equals("/", Platform.pathSeparator, "$os path-seperator");
|
||||
}
|
||||
var hostname = Platform.localHostname;
|
||||
Expect.isTrue(hostname is String && hostname != "");
|
||||
var environment = Platform.environment;
|
||||
|
|
|
@ -32,12 +32,13 @@ test() {
|
|||
Expect.equals(Platform.isMacOS, Platform.operatingSystem == "macos");
|
||||
Expect.equals(Platform.isWindows, Platform.operatingSystem == "windows");
|
||||
Expect.equals(Platform.isAndroid, Platform.operatingSystem == "android");
|
||||
var sep = Platform.pathSeparator;
|
||||
Expect.isTrue(sep == '/' || (os == 'windows' && sep == '\\'));
|
||||
final eol = Platform.lineTerminator;
|
||||
Expect.isTrue(
|
||||
(eol == '\n' && os != 'windows') || (eol == '\r\n' && os == 'windows'),
|
||||
"unexpected line ending ${utf8.encode(eol)} on $os");
|
||||
if (Platform.isWindows) {
|
||||
Expect.equals("\r\n", Platform.lineTerminator, "windows lineTerminator");
|
||||
Expect.equals("\\", Platform.pathSeparator, "$os path-seperator");
|
||||
} else {
|
||||
Expect.equals("\n", Platform.lineTerminator, "$os lineTerminator");
|
||||
Expect.equals("/", Platform.pathSeparator, "$os path-seperator");
|
||||
}
|
||||
var hostname = Platform.localHostname;
|
||||
Expect.isTrue(hostname is String && hostname != "");
|
||||
var environment = Platform.environment;
|
||||
|
|
Loading…
Reference in a new issue