@@ -1070,17 +1070,33 @@ test "list" {
10701070 defer testfs .deinit ();
10711071 root = testfs .tree .val ;
10721072
1073- const child_1 = try openFile ("/child1.txt" , .CREATE_FILE );
1074- const child_2 = try openFile ("/child2.txt" , .CREATE_FILE );
1075- const child_3 = try openDir ("/child3" , .CREATE_DIR );
1073+ const child_1_name = "child1.txt" ;
1074+ const child_2_name = "child2.txt" ;
1075+ const child_3_name = "child3" ;
1076+ const child_3_1_name = "child3_1.txt" ;
1077+ const child_3_2_name = "child3_2.txt" ;
1078+
1079+ const child_1 = try openFile ("/" ++ child_1_name , .CREATE_FILE );
1080+ const child_2 = try openFile ("/" ++ child_2_name , .CREATE_FILE );
1081+ const child_3 = try openDir ("/" ++ child_3_name , .CREATE_DIR );
10761082
10771083 var iterator = root .Dir .list ();
10781084 defer iterator .deinit ();
1079- testing .expectEqual (child_1 , iterator .next ());
1080- testing .expectEqual (child_2 , iterator .next ());
1081- testing .expectEqual (null , iterator .next ());
1085+ testing .expectEqualSlices (child_1_name , iterator .next ());
1086+ testing .expectEqualSlices (child_2_name , iterator .next ());
1087+ testing .expectEqualSlices (child_3_name , iterator .next ());
1088+ testing .expectEqualSlices (null , iterator .next ());
10821089
10831090 var iterator2 = child_3 .list ();
10841091 defer iterator2 .deinit ();
1085- testing .expectEqual (null , iterator2 .next ());
1092+ testing .expectEqualSlices (null , iterator2 .next ());
1093+
1094+ const child_3_1 = try openDir ("/" ++ child_3_name ++ "/" ++ child_3_1_name , .CREATE_DIR );
1095+ testing .expectEqualSlices (child_3_1_name , iterator2 .next ());
1096+ testing .expectEqualSlices (null , iterator2 .next ());
1097+
1098+ const child_3_2 = try openDir ("/" ++ child_3_name ++ "/" ++ child_3_2_name , .CREATE_DIR );
1099+ testing .expectEqualSlices (child_3_1_name , iterator2 .next ());
1100+ testing .expectEqualSlices (child_3_2_name , iterator2 .next ());
1101+ testing .expectEqualSlices (null , iterator2 .next ());
10861102}
0 commit comments