// Copyright (c) 2020, 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. #if defined(HOST_OS_MACOS) #include "bin/platform.h" #include "vm/unit_test.h" namespace dart { TEST_CASE(Platform_ExtractsOSVersionFromString) { char str[] = "some overheads\nProductVersion\nsome bytesFake " "version"; char* result = bin::ExtractsOSVersionFromString(str); EXPECT(result != NULL); EXPECT_STREQ("Fake version", result); EXPECT(bin::ExtractsOSVersionFromString("ProductVersion") == NULL); // Incomplete file EXPECT(bin::ExtractsOSVersionFromString( "ProductVersionFake version\n" "\n" "\n" "\n" " ProductBuildVersion\n" " 19E287\n" " ProductCopyright\n" " 1983-2020 Apple Inc.\n" " ProductName\n" " Mac OS X\n" " ProductUserVisibleVersion\n" " 10.15.4\n" " ProductVersion\n" " 10.15.4\n" " iOSSupportVersion\n" " 13.4\n" "\n" "" result = bin::ExtractsOSVersionFromString(str); EXPECT(result != NULL); EXPECT_STREQ("10.15.4", result); } } // namespace dart #endif // defined(HOST_OS_MACOS)