From 8b3edc0401da5615cbb50de707bd0d63ca15fe68 Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Thu, 18 Jul 2019 15:03:15 -0500 Subject: [PATCH] Add operatingSystemVersion --- lib/src/interface/local_platform.dart | 3 +++ lib/src/interface/platform.dart | 4 ++++ lib/src/testing/fake_platform.dart | 6 ++++++ test/fake_platform_test.dart | 2 ++ test/platform.json | 1 + 5 files changed, 16 insertions(+) diff --git a/lib/src/interface/local_platform.dart b/lib/src/interface/local_platform.dart index 27c1871..20b4bbe 100644 --- a/lib/src/interface/local_platform.dart +++ b/lib/src/interface/local_platform.dart @@ -20,6 +20,9 @@ class LocalPlatform extends Platform { @override String get operatingSystem => io.Platform.operatingSystem; + @override + String get operatingSystemVersion => io.Platform.operatingSystemVersion; + @override String get localHostname => io.Platform.localHostname; diff --git a/lib/src/interface/platform.dart b/lib/src/interface/platform.dart index 1ebc5a9..afc527a 100644 --- a/lib/src/interface/platform.dart +++ b/lib/src/interface/platform.dart @@ -22,6 +22,9 @@ abstract class Platform { /// representing the operating system. String get operatingSystem; + /// A string representing the version of the operating system or platform. + String get operatingSystemVersion; + /// Get the local hostname for the system. String get localHostname; @@ -129,6 +132,7 @@ abstract class Platform { 'numberOfProcessors': numberOfProcessors, 'pathSeparator': pathSeparator, 'operatingSystem': operatingSystem, + 'operatingSystemVersion': operatingSystemVersion, 'localHostname': localHostname, 'environment': environment, 'executable': executable, diff --git a/lib/src/testing/fake_platform.dart b/lib/src/testing/fake_platform.dart index 3626d54..0d868bd 100644 --- a/lib/src/testing/fake_platform.dart +++ b/lib/src/testing/fake_platform.dart @@ -16,6 +16,7 @@ class FakePlatform extends Platform { this.numberOfProcessors, this.pathSeparator, this.operatingSystem, + this.operatingSystemVersion, this.localHostname, this.environment, this.executable, @@ -36,6 +37,7 @@ class FakePlatform extends Platform { : numberOfProcessors = platform.numberOfProcessors, pathSeparator = platform.pathSeparator, operatingSystem = platform.operatingSystem, + operatingSystemVersion = platform.operatingSystemVersion, localHostname = platform.localHostname, environment = new Map.from(platform.environment), executable = platform.executable, @@ -61,6 +63,7 @@ class FakePlatform extends Platform { numberOfProcessors: map['numberOfProcessors'], pathSeparator: map['pathSeparator'], operatingSystem: map['operatingSystem'], + operatingSystemVersion: map['operatingSystemVersion'], localHostname: map['localHostname'], environment: map['environment'].cast(), executable: map['executable'], @@ -85,6 +88,9 @@ class FakePlatform extends Platform { @override String operatingSystem; + @override + String operatingSystemVersion; + @override String localHostname; diff --git a/test/fake_platform_test.dart b/test/fake_platform_test.dart index 1fa7e8f..90d8209 100644 --- a/test/fake_platform_test.dart +++ b/test/fake_platform_test.dart @@ -11,6 +11,7 @@ void _expectPlatformsEqual(Platform actual, Platform expected) { expect(actual.numberOfProcessors, expected.numberOfProcessors); expect(actual.pathSeparator, expected.pathSeparator); expect(actual.operatingSystem, expected.operatingSystem); + expect(actual.operatingSystemVersion, expected.operatingSystemVersion); expect(actual.localHostname, expected.localHostname); expect(actual.environment, expected.environment); expect(actual.executable, expected.executable); @@ -63,6 +64,7 @@ void main() { expect(fake.numberOfProcessors, 8); expect(fake.pathSeparator, '/'); expect(fake.operatingSystem, 'macos'); + expect(fake.operatingSystemVersion, '10.14.5'); expect(fake.localHostname, 'platform.test.org'); expect(fake.environment, { 'PATH': '/bin', diff --git a/test/platform.json b/test/platform.json index a39381c..8fb41ee 100644 --- a/test/platform.json +++ b/test/platform.json @@ -2,6 +2,7 @@ "numberOfProcessors": 8, "pathSeparator": "/", "operatingSystem": "macos", + "operatingSystemVersion": "10.14.5", "localHostname": "platform.test.org", "environment": { "PATH": "/bin",