-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sgrekhov
committed
Feb 25, 2022
1 parent
971ac72
commit 9a3da0a
Showing
4 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) 2022, 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. | ||
|
||
/// @assertion Abi.current() | ||
/// The ABI the Dart VM is currently running on. | ||
/// | ||
/// @description Checks that this method returns the ABI the Dart VM is | ||
/// currently running on | ||
/// @author sgrekhov@unipro.ru | ||
import "dart:ffi"; | ||
import "../../../Utils/expect.dart"; | ||
|
||
main() { | ||
final abi = Abi.current(); | ||
Expect.isTrue(Abi.values.contains(abi)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) 2022, 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. | ||
|
||
/// @assertion Abi.current() | ||
/// The ABI the Dart VM is currently running on. | ||
/// | ||
/// @description Checks that this method returns the ABI the Dart VM is | ||
/// currently running on | ||
/// @author sgrekhov@unipro.ru | ||
import "dart:ffi"; | ||
import 'dart:io'; | ||
import "../../../Utils/expect.dart"; | ||
|
||
main() { | ||
final abi = Abi.current(); | ||
Expect.isTrue(Abi.values.contains(abi)); | ||
if (Platform.isAndroid) { | ||
Expect.isTrue( | ||
abi == Abi.androidArm || | ||
abi == Abi.androidArm64 || | ||
abi == Abi.androidIA32 || | ||
abi == Abi.androidX64, | ||
abi.toString()); | ||
} | ||
if (Platform.isFuchsia) { | ||
Expect.isTrue( | ||
abi == Abi.fuchsiaArm64 || abi == Abi.fuchsiaX64, abi.toString()); | ||
} | ||
if (Platform.isIOS) { | ||
Expect.isTrue(abi == Abi.iosArm || abi == Abi.iosArm64 || abi == Abi.iosX64, | ||
abi.toString()); | ||
} | ||
if (Platform.isLinux) { | ||
Expect.isTrue( | ||
abi == Abi.linuxArm || | ||
abi == Abi.linuxArm64 || | ||
abi == Abi.linuxX64 || | ||
abi == Abi.linuxIA32 || | ||
abi == Abi.linuxRiscv32 || | ||
abi == Abi.linuxRiscv64, | ||
abi.toString()); | ||
} | ||
if (Platform.isMacOS) { | ||
Expect.isTrue(abi == Abi.macosX64 || abi == Abi.macosArm64, abi.toString()); | ||
} | ||
if (Platform.isWindows) { | ||
Expect.isTrue( | ||
abi == Abi.windowsArm64 || | ||
abi == Abi.windowsIA32 || | ||
abi == Abi.windowsX64, | ||
abi.toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) 2022, 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. | ||
|
||
/// @assertion @override | ||
/// String toString() | ||
/// override | ||
/// A string representation of this ABI. | ||
/// | ||
// The string is equal to the 'on' part from Platform.version and dart --version | ||
/// | ||
/// @description Checks that this method returns a string which is equal to the | ||
/// 'on' part from Platform.version | ||
/// @author sgrekhov@unipro.ru | ||
import "dart:ffi"; | ||
import 'dart:io'; | ||
import "../../../Utils/expect.dart"; | ||
|
||
main() { | ||
final abi = Abi.current(); | ||
String expected = Platform.version | ||
.substring(Platform.version.indexOf(" on ") + 4) | ||
.trim() | ||
.replaceAll("\"", ""); | ||
Expect.equals(expected, abi.toString()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) 2022, 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. | ||
|
||
/// @assertion values constant Null safety | ||
/// List<Abi> const values | ||
/// The ABIs that the DartVM can run on. | ||
/// | ||
/// Does not contain a macosIA32. We have stopped supporting 32-bit MacOS. | ||
/// | ||
/// Includes windowsArm64, even though it is currently not supported. Support | ||
/// has been requested for Flutter. | ||
/// https://github.com/flutter/flutter/issues/53120 | ||
/// | ||
/// @description Checks that this list contains `windowsArm64` and the current | ||
/// ABI | ||
/// @author sgrekhov@unipro.ru | ||
import "dart:ffi"; | ||
import "../../../Utils/expect.dart"; | ||
|
||
main() { | ||
Expect.isTrue(Abi.values.contains(Abi.current())); | ||
Expect.isTrue(Abi.values.contains(Abi.windowsArm64)); | ||
} |