Skip to content

Commit

Permalink
Add Platform.is_unix alias
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Jul 19, 2022
1 parent 20684cb commit 48267b4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions test/Table_Tests/src/Database/Postgresql_Spec.enso
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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) <|
Expand Down
4 changes: 2 additions & 2 deletions test/Tests/src/System/File_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 48267b4

Please sign in to comment.