diff --git a/distribution/lib/Standard/AWS/0.0.0-dev/src/S3/S3_File.enso b/distribution/lib/Standard/AWS/0.0.0-dev/src/S3/S3_File.enso index df98c56f1370..e973f2371f6e 100644 --- a/distribution/lib/Standard/AWS/0.0.0-dev/src/S3/S3_File.enso +++ b/distribution/lib/Standard/AWS/0.0.0-dev/src/S3/S3_File.enso @@ -1,4 +1,5 @@ from Standard.Base import all +import Standard.Base.Data.Ordering.Vector_Lexicographic_Order import Standard.Base.Enso_Cloud.Data_Link.Data_Link import Standard.Base.Enso_Cloud.Data_Link.Data_Link_From_File import Standard.Base.Enso_Cloud.Data_Link_Helpers @@ -195,7 +196,7 @@ type S3_File S3_File.Value (S3_Path.Value bucket key) self.credentials files = pair.second . map key-> S3_File.Value (S3_Path.Value bucket key) self.credentials - sub_folders + files + (sub_folders + files) . sort on=.path ## ALIAS load bytes, open bytes ICON data_input diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Enso_Cloud/Enso_File.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Enso_Cloud/Enso_File.enso index 8bdb45a0da94..5ab7db381b97 100644 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Enso_Cloud/Enso_File.enso +++ b/distribution/lib/Standard/Base/0.0.0-dev/src/Enso_Cloud/Enso_File.enso @@ -1,6 +1,7 @@ import project.Any.Any import project.Data.Color.Color import project.Data.Json.JS_Object +import project.Data.Ordering.Vector_Lexicographic_Order import project.Data.Numbers.Integer import project.Data.Text.Encoding.Encoding import project.Data.Text.Text @@ -488,10 +489,11 @@ type Enso_File if self.is_directory.not then Error.throw (Illegal_Argument.Error "Cannot `list` a non-directory.") else # Remove secrets from the list - they are handled separately in `Enso_Secret.list`. assets = list_assets self . filter f-> f.asset_type != Enso_Asset_Type.Secret - assets.map asset-> + results = assets.map asset-> file = Enso_File.Value (self.enso_path.resolve asset.name) Asset_Cache.update file asset file + results.sort on=.path ## GROUP Output ICON folder_add diff --git a/test/AWS_Tests/src/S3_Spec.enso b/test/AWS_Tests/src/S3_Spec.enso index 0df2fb291f2c..d9ac0e683788 100644 --- a/test/AWS_Tests/src/S3_Spec.enso +++ b/test/AWS_Tests/src/S3_Spec.enso @@ -259,6 +259,12 @@ add_specs suite_builder = r3.should_be_a Vector r3.map .name . should_contain object_name + group_builder.specify "list should sort its output" <| + r = root.list + r.should_be_a Vector + as_strings = r.map .to_text + as_strings . should_equal as_strings.sort + group_builder.specify "should be able to list buckets by constructing a root object" <| with_default_credentials <| just_s3 = File.new "s3://" diff --git a/test/Base_Tests/src/Network/Enso_Cloud/Enso_File_Spec.enso b/test/Base_Tests/src/Network/Enso_Cloud/Enso_File_Spec.enso index 9b35a37945d4..f71f471e986c 100644 --- a/test/Base_Tests/src/Network/Enso_Cloud/Enso_File_Spec.enso +++ b/test/Base_Tests/src/Network/Enso_Cloud/Enso_File_Spec.enso @@ -41,6 +41,12 @@ add_specs suite_builder setup:Cloud_Tests_Setup = suite_builder.group "Enso Clou Data.list test_root.get . map .name . should_contain "test_file.json" Data.list test_root.get.path . map .name . should_contain "test_file.json" + group_builder.specify "list should sort its output" <| + r = Enso_File.home.list + r.should_be_a Vector + as_strings = r.map .to_text + as_strings . should_equal as_strings.sort + group_builder.specify "should allow to create and delete a directory" <| my_name = "my_test_dir-" + (Random.uuid.take 5) my_dir = (test_root.get / my_name).create_directory