From 48267b4432913bf3ef4f59b6aedeabd4244b6b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Wa=C5=9Bko?= Date: Tue, 19 Jul 2022 15:28:16 +0200 Subject: [PATCH] Add Platform.is_unix alias --- .../lib/Standard/Base/0.0.0-dev/src/System/Platform.enso | 4 ++++ test/Table_Tests/src/Database/Postgresql_Spec.enso | 4 ++-- test/Tests/src/System/File_Spec.enso | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/System/Platform.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/System/Platform.enso index f94c37bb9c973..22009d2ba1716 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/System/Platform.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/System/Platform.enso @@ -26,6 +26,10 @@ type Os os : Os os = from_text System.os +## Check if the currently running platform is a UNIX platform. +is_unix : Boolean +is_unix = System.is_unix + ## PRIVATE Create an Os object from text. diff --git a/test/Table_Tests/src/Database/Postgresql_Spec.enso b/test/Table_Tests/src/Database/Postgresql_Spec.enso index 487f2fd97d2cd..df2bdb7c0e52e 100644 --- a/test/Table_Tests/src/Database/Postgresql_Spec.enso +++ b/test/Table_Tests/src/Database/Postgresql_Spec.enso @@ -1,7 +1,7 @@ from Standard.Base import all import Standard.Base.System.Environment import Standard.Base.Runtime.Ref -import Standard.Base.System +import Standard.Base.System.Platform import Standard.Base.System.Process from Standard.Base.System.Process.Exit_Code import Exit_Success @@ -155,7 +155,7 @@ pgpass_spec = Test.group "[PostgreSQL] .pgpass" <| entries = [e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12] result.should_equal entries - if System.is_unix then + if Platform.is_unix then Test.specify "should only accept the .pgpass file if it has correct permissions" <| Process.run "chmod" ["0777", pgpass_file.absolute.path] . should_equal Exit_Success Environment.unsafe_with_environment_override "PGPASSFILE" (pgpass_file.absolute.path) <| diff --git a/test/Tests/src/System/File_Spec.enso b/test/Tests/src/System/File_Spec.enso index 3758981136584..1c7b5752d19ec 100644 --- a/test/Tests/src/System/File_Spec.enso +++ b/test/Tests/src/System/File_Spec.enso @@ -4,7 +4,7 @@ from Standard.Base.Data.Text.Encoding as Encoding_Module import Encoding, Encodi import Standard.Base.System.File.Existing_File_Behavior from Standard.Base.System.File import File_Already_Exists_Error from Standard.Base.Error.Problem_Behavior import all -import Standard.Base.System +import Standard.Base.System.Platform import Standard.Base.System.Process from Standard.Base.System.File.File_Permissions as File_Permissions_Module import all from Standard.Base.System.Process.Exit_Code import Exit_Success @@ -66,7 +66,7 @@ spec = file = File.new "does_not_exist.txt" file.delete . should_fail_with File.File_Not_Found - if System.is_unix then + if Platform.is_unix then Test.specify "should allow to check file permissions" <| f = enso_project.data / "transient" / "permissions.txt" f.delete_if_exists