Skip to content

Commit 4ed1443

Browse files
authored
AutoFixTest: fix indentation, other code style for copy_recursive () (#184)
1 parent 8ae2bb6 commit 4ed1443

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

test/AutoFixTest.vala

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,14 @@ class AutoFixTest : GLib.Object {
2929
Vala.ArrayList<ValaLint.FormatMistake?> mistakes;
3030
}
3131

32-
public bool copy_recursive (GLib.File src, GLib.File dest, GLib.FileCopyFlags flags = GLib.FileCopyFlags.NONE,
33-
GLib.Cancellable? cancellable = null) throws GLib.Error {
34-
GLib.FileType src_type = src.query_file_type (GLib.FileQueryInfoFlags.NONE, cancellable);
35-
if (src_type == GLib.FileType.DIRECTORY) {
32+
public bool copy_recursive (
33+
GLib.File src,
34+
GLib.File dest,
35+
GLib.FileCopyFlags flags = NONE,
36+
GLib.Cancellable? cancellable = null
37+
) throws GLib.Error {
38+
var src_type = src.query_file_type (NONE, cancellable);
39+
if (src_type == DIRECTORY) {
3640
if (!dest.query_exists ()) {
3741
dest.make_directory (cancellable);
3842
}
@@ -41,22 +45,27 @@ class AutoFixTest : GLib.Object {
4145

4246
string src_path = src.get_path ();
4347
string dest_path = dest.get_path ();
44-
GLib.FileEnumerator enumerator = src.enumerate_children (GLib.FileAttribute.STANDARD_NAME,
45-
GLib.FileQueryInfoFlags.NONE, cancellable);
46-
47-
for ( GLib.FileInfo? info = enumerator.next_file (cancellable);
48-
info != null ; info = enumerator.next_file (cancellable) ) {
49-
copy_recursive (
50-
GLib.File.new_for_path (GLib.Path.build_filename (src_path, info.get_name ())),
51-
GLib.File.new_for_path (GLib.Path.build_filename (dest_path, info.get_name ())),
52-
flags,
53-
cancellable);
48+
var enumerator = src.enumerate_children (
49+
GLib.FileAttribute.STANDARD_NAME, NONE, cancellable
50+
);
51+
52+
for (
53+
GLib.FileInfo? info = enumerator.next_file (cancellable);
54+
info != null;
55+
info = enumerator.next_file (cancellable)
56+
) {
57+
copy_recursive (
58+
GLib.File.new_for_path (GLib.Path.build_filename (src_path, info.get_name ())),
59+
GLib.File.new_for_path (GLib.Path.build_filename (dest_path, info.get_name ())),
60+
flags,
61+
cancellable
62+
);
5463
}
55-
} else if ( src_type == GLib.FileType.REGULAR) {
64+
} else if (src_type == REGULAR) {
5665
src.copy (dest, flags, cancellable);
57-
}
66+
}
5867

59-
return true;
68+
return true;
6069
}
6170

6271
public Vala.ArrayList<File> get_test_files_from_dir (File dir) throws Error, IOError {
@@ -99,7 +108,7 @@ class AutoFixTest : GLib.Object {
99108
assert (inital_auto_fix_files_dir.query_exists ());
100109

101110
try {
102-
copy_recursive (inital_auto_fix_files_dir, output_dir, FileCopyFlags.OVERWRITE);
111+
copy_recursive (inital_auto_fix_files_dir, output_dir, OVERWRITE);
103112
} catch (Error e) {
104113
error ("Error!: %s", e.message);
105114
}

0 commit comments

Comments
 (0)